Communication Method, Communications Device, And Storage Medium

ABSTRACT

The present disclosure relates to communication methods, communications devices, and storage medium. In one example method, a port of a first device supports a flexible Ethernet protocol and a standard Ethernet protocol, and a protocol type supported by a port of a second device includes at least one of the flexible Ethernet protocol or the standard Ethernet protocol. The first device obtains the protocol type supported by the port of the second device, determines a target protocol type based on the protocol type supported by the port of the second device and a protocol type supported by the port of the first device, and communicates with the second device based on the target protocol type. The target protocol type includes the flexible Ethernet protocol or the standard Ethernet protocol.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of International Application No.PCT/CN2018/095001, filed on Jul. 9, 2018, which claims priority toChinese Patent Application No. 201710608033.8, filed on Jul. 24, 2017.The disclosures of the aforementioned applications are herebyincorporated by reference in their entireties.

TECHNICAL FIELD

This application relates to the communications field, and in particular,to a communication method, a communications device, and a storagemedium.

BACKGROUND

A related standard of an 802.3 standard Ethernet (StdE) defined by theinstitute of electrical and electronics engineers (IEEE) is widely citedin the industry. The standard Ethernet is very popular withmanufacturers because of a simple principle, easy implementation, and alow price. However, with development of technologies, a bandwidthgranularity difference is increasingly large, and a deviation between aninterface of the standard Ethernet and an actual application requirementis also increasingly large. The following case is most likely to appear:A bandwidth required by a mainstream application does not belong to anyexisting Ethernet standard rate. For example, resources are wasted if a100 GE port is used to carry a 50 Gb/s service, and there is nocorresponding Ethernet standard granularity for carrying a 200 Gb/sservice.

To address this challenge, an optical Internet forum (OIF) releases aflexible Ethernet (FlexE). The FlexE is a general technology thatsupports a plurality of Ethernet MAC layer rates. A plurality of 100 GE(Physical. PHYs) interfaces are bound, and each 100 GE port is dividedinto 20 slots in time domain by using 5G as a granularity, so that theFlexE can support the following functions: a binding function, that is,a plurality of Ethernet interfaces are bound to form one link group tosupport a medium access control (MAC) service whose rate is greater thanthat of a single Ethernet interface; a sub-rate function, that is, aslot is allocated to a service to support a MAC service whose rate isless than a link group bandwidth or less than a bandwidth of a singleEthernet interface; and a channelization function, that is, a slot isallocated to a service to simultaneously transmit a plurality of MACservices in a link group, for example, one 150G MAC service and two 25GMAC services can be simultaneously transmitted in a 2×100 GE link group.

Based on the foregoing case, an Ethernet port may have two protocolmodes: a standard Ethernet protocol and a flexible Ethernet protocol.Currently, a communication solution is urgently required to implementcommunication between Ethernet ports of this type.

SUMMARY

Embodiments of this application provide a communication method, acommunications device, and a storage medium, to implement communicationbetween another port and a port supporting both a flexible Ethernetprotocol and a standard Ethernet protocol.

According to a first aspect, an embodiment of this application providesa communication method. In the method, a first device obtains a protocoltype supported by a second port of a second device, where the protocoltype supported by the second port of the second device includes aflexible Ethernet protocol and/or a standard Ethernet protocol, and afirst port of the first device supports the flexible Ethernet protocoland the standard Ethernet protocol; the first device determines a targetprotocol type based on the protocol type supported by the second portand a protocol type supported by the first port, where the targetprotocol type includes the flexible Ethernet protocol or the standardEthernet protocol; and the first device communicates with the seconddevice based on the target protocol type through the first port and thesecond port.

The first device in this embodiment of this application may include oneor more ports. The first port in this embodiment of this application isspecifically a port that is of the first device and that can support twotypes of protocols. To be specific, one or more ports that are of thefirst device and that support two protocol types may be referred to asfirst ports. The second device may also include one or more ports, andthe second port is a port that is of the second device and that has alink with the first port. The second port may support one protocol type,such as the standard Ethernet protocol or the flexible Ethernetprotocol; or the second port may support two types of protocols. Whenthe second port supports two protocol types, the second port may alsoperform a solution similar to a solution performed by the first port inthis embodiment of this application. For specific content, refer todescriptions in subsequent embodiments.

In this embodiment of this application, the port of the first devicesupports the flexible Ethernet protocol and the standard Ethernetprotocol, and the protocol type supported by the port of the seconddevice includes the flexible Ethernet protocol and/or the standardEthernet protocol. The first device obtains the protocol type supportedby the port of the second device, determines the target protocol typebased on the protocol type supported by the port of the second deviceand the protocol type supported by the port of the first device, andcommunicates with the second device based on the target protocol type.The target protocol type includes the flexible Ethernet protocol or thestandard Ethernet protocol. In this way, communication between anotherport and a port supporting both the flexible Ethernet protocol and thestandard Ethernet protocol is implemented.

In a possible design, after the first device determines the targetprotocol type, the first device sends information to the second port ofthe second device based on the target protocol type through the firstport, so that the second port can successfully parse the informationsent from the first port. In a possible design, after the first devicedetermines the target protocol type, the first device receives, based onthe target protocol type through the first port, information sent fromthe second port of the second device, so that the first port cansuccessfully parse the information sent from the second port. In apossible design, the first device sends information to the second portof the second device based on the target protocol type through the firstport, and receives, based on the target protocol type through the firstport, information sent from the second port of the second device, sothat a protocol type used by the first port to send information isconsistent with a protocol type used by the first port to receiveinformation. Therefore, the first port better communicates with thesecond port, and the first port and the second port are also easilymanaged.

In a possible design, before the first device determines the targetprotocol type, the method further includes: obtaining, by the firstdevice by using a physical coding sublayer PCS code block, a protocoltype currently used by the second port to send information. To bespecific, indication information used to indicate the protocol typesupported by the second port is carried in the PCS code block.Therefore, when two ports transmit information to each other by usingthe PCS code block, PCS layer information can still be parsed even ifprotocol types used by the two ports are different. Based on this, inthis embodiment of this application, the indication information used toindicate the protocol type supported by the second port is transmittedby using the PCS code block. Even if a protocol type used by the firstport to receive information is different from a protocol type used bythe second port to send information, the first port can stillsuccessfully obtain, through parsing, the indication information that issent by the second port by using the PCS code block and that is used toindicate the protocol type supported by the second port, so that thefirst port successfully obtains the protocol type supported by thesecond port.

In a possible design, the obtaining, by the first device by using afirst PCS code block, a protocol type currently used by the second portto send information includes: when a first preset PCS code block isreceived, determining, by the first device, that the protocol typecurrently used by the second port to send information is the flexibleEthernet protocol; or when a first preset PCS code block is notreceived, determining, by the first device, that the protocol typecurrently used by the second port to send information is the standardEthernet protocol. There are a plurality of specific determiningmanners. For example, if it is determined that information received bythe first port does not include the first preset PCS code block, or ifit is found that information received by the first port includes a thirdpreset PCS code block, it may be determined that the protocol typecurrently used by the second port to send information is the standardEthernet protocol. In this way, the first port may conveniently andquickly determine the protocol type currently used by the second port tosend information.

In a possible design, the obtaining, by a first device, a protocol typesupported by a second port of a second device includes: receiving, bythe first device through the first port based on the obtained protocoltype currently used by the second port to send information, theindication information used to indicate the protocol type supported bythe second port. In this way, a working state of the first port may beactively adapted to a working state of the peer end, that is, a protocolused by the first port to receive information is actively adapted to aprotocol used by the second port to send information.

To improve solution flexibility, in a possible design, the indicationinformation used to indicate the protocol type supported by the secondport is carried in a control packet at a medium access control MAClayer; or the indication information used to indicate the protocol typesupported by the second port is carried in a control packet at anotherlayer higher than a MAC layer.

In a possible design, the obtaining, by a first device, a protocol typesupported by a second port of a second device includes: when determiningthat the obtained protocol type currently used by the second port tosend information is a non-preset protocol type, determining, by thefirst device, that the protocol type supported by the second port of thesecond device is the non-preset protocol type, where a preset protocoltype includes the flexible Ethernet protocol, and the non-presetprotocol type includes the standard Ethernet protocol; or a presetprotocol type includes the standard Ethernet protocol, and thenon-preset protocol type includes the flexible Ethernet protocol. Inthis way, the protocol type supported by the second port may bedetermined by using a simpler solution, and time overheads are reduced.

In a possible design, the obtaining, by a first device, a protocol typesupported by a second port of a second device includes:

obtaining, by the first device by using the PCS code block, the protocoltype supported by the second port.

In a possible design, the obtaining, by a first device, a protocol typesupported by a second port of a second device includes at least one ofthe following content: when a second preset PCS code block is received,determining, by the first device, that the protocol type supported bythe second port includes the flexible Ethernet protocol and the standardEthernet protocol; when a second preset PCS code block is not receivedand the first preset PCS code block is received, determining, by thefirst device, that the protocol type supported by the second port is theflexible Ethernet protocol; or when neither a second preset PCS codeblock nor the first preset PCS code block is received, determining, bythe first device, that the protocol type supported by the second port isthe standard Ethernet protocol. In this way, the first port maydetermine, by using the first preset PCS code block and the secondpreset PCS code block, the protocol type supported by the second port.This is simple and fast, and can reduce time overheads.

In a possible design, the first preset PCS code block includes an OHframe header code block of the flexible Ethernet protocol.

In a possible design, to select a better target protocol type, in anoptional implementation, the protocol type supported by the second portof the second device includes the flexible Ethernet protocol and thestandard Ethernet protocol; the first device obtains first indicationinformation; and the first device determines the target protocol typebased on the first indication information and the protocol typesupported by the first port of the first device. The first indicationinformation is used to indicate a protocol type with a higher priorityin the protocol type supported by the second port, and second indicationinformation is used to indicate a priority level of the protocol typewith a higher priority in the protocol type supported by the secondport.

In a possible design, to select a better target protocol type, theprotocol type supported by the second port of the second device includesthe flexible Ethernet protocol and the standard Ethernet protocol; thefirst device obtains first indication information; and the first devicedetermines the target protocol type based on the first indicationinformation and a protocol type with a higher priority in the protocoltype supported by the first port of the first device.

In a possible design, to select a better target protocol type, beforethe first device determines the target protocol type based on theprotocol type supported by the second port of the second device and theprotocol type supported by the second port of the first device, themethod further includes: obtaining, by the first device, secondindication information; and determining, by the first device, the targetprotocol type based on first indication information, the secondindication information, a protocol type with a higher priority in theprotocol type supported by the first port of the first device, and apriority level of the protocol type with a higher priority in theprotocol type supported by the first port of the first device.

According to a second aspect, an embodiment of this application providesa communication method. In the method, a second device generatesindication information used to indicate a protocol type supported by asecond port of the second device, where the protocol type supported bythe second port of the second device includes a flexible Ethernetprotocol and/or a standard Ethernet protocol; and the second devicesends the indication information used to indicate the protocol typesupported by the second port.

A first device in this embodiment of this application may include one ormore ports. A first port in this embodiment of this application isspecifically a port that is of the first device and that can support twotypes of protocols. To be specific, one or more ports that are of thefirst device and that support two protocol types may be referred to asfirst ports. The second device may also include one or more ports, andthe second port is a port that is of the second device and that has alink with the first port. The second port may support one protocol type,such as the standard Ethernet protocol or the flexible Ethernetprotocol; or the second port may support two types of protocols. Whenthe second port supports two protocol types, the second port may alsoperform a solution similar to a solution performed by the first port inthis embodiment of this application. For specific content, refer todescriptions in subsequent embodiments.

In this embodiment of this application, the second device sends theindication information used to indicate the protocol type supported bythe second port, so that a peer end can communicate with the second portbased on a capability of the second port of the second device.

In a possible design, the method further includes: sending, by thesecond device by using a physical coding sublayer PCS code block,indication information used to indicate a protocol type currently usedby the second port to send information. To be specific, the indicationinformation used to indicate the protocol type supported by the secondport is carried in the PCS code block. Therefore, when two portstransmit information to each other by using the PCS code block, PCSlayer information can still be parsed even if protocol types used by thetwo ports are different. Based on this, in this embodiment of thisapplication, the indication information used to indicate the protocoltype supported by the second port is transmitted by using the PCS codeblock. Even if a protocol type used by the first port to receiveinformation is different from a protocol type used by the second port tosend information, the first port can still successfully obtain, throughparsing, the indication information that is sent by the second port byusing the PCS code block and that is used to indicate the protocol typesupported by the second port, so that the first port successfullyobtains the protocol type supported by the second port.

In a possible design, the sending, by the second device by using aphysical coding sublayer PCS code block, indication information used toindicate a protocol type currently used by the second port to sendinformation includes: sending, by the second device, a first preset PCScode block when the protocol type currently used by the second port tosend information is the flexible Ethernet protocol. In this way, thefirst device may determine, by using the first preset PCS code block,the protocol type currently used by the second port to send information.This can reduce time overheads, and can lay a foundation forestablishing a temporary channel subsequently.

In a possible design, to improve solution flexibility, the sending, bythe second device, the indication information used to indicate theprotocol type supported by the second port includes: sending, by thesecond device, information based on a preset protocol type when thesecond port supports the flexible Ethernet protocol and the standardEthernet protocol, where if the preset protocol type is the flexibleEthernet protocol, the information includes the first preset PCS codeblock; or if the preset protocol type is the standard Ethernet protocol,the information does not include the first preset PCS code block.

In a possible design, the indication information used to indicate theprotocol type supported by the second port of the second device iscarried in a control packet at a medium access control MAC layer; or theindication information used to indicate the protocol type supported bythe second port of the second device is carried in a control packet atanother layer higher than a MAC layer. In a possible design, theindication information used to indicate the protocol type supported bythe second port is carried in the PCS code block. In this way, solutionflexibility can be improved.

In a possible design, the sending, by the second device, the indicationinformation used to indicate the protocol type supported by the secondport of the second device includes at least one of the followingcontent: when the second port of the second device supports the flexibleEthernet protocol and the standard Ethernet protocol, sendinginformation including a second preset PCS code block; when the secondport of the second device supports the flexible Ethernet protocol,sending information that does not include a second preset PCS code blockand includes the first preset PCS code block; or when the second port ofthe second device supports the standard Ethernet protocol, sendinginformation including neither a second preset PCS code block nor thefirst preset PCS code block. In this way, the first port may determine,by using the first preset PCS code block and the second preset PCS codeblock, the protocol type supported by the second port. This is simpleand fast, and can reduce time overheads.

In a possible design, the first preset PCS code block includes an OHframe header code block of the flexible Ethernet protocol.

In a possible design, to select a better target protocol type, theprotocol type supported by the second port includes the flexibleEthernet protocol and the standard Ethernet protocol. The method furtherincludes: sending, by the second device, first indication information;or sending, by the second device, first indication information andsecond indication information. The first indication information is usedto indicate a protocol type with a higher priority in the protocol typesupported by the second port, and the second indication information isused to indicate a priority level of the protocol type with a higherpriority in the protocol type supported by the second port.

Corresponding to the communication method according to any one of thefirst aspect and the second aspect, this application further provides acommunications device. The communications device may be any transmit enddevice or receive end device that transmits data in a wireless manner,for example, a communications chip, user equipment, or a network device(for example, a base station). In a communication process, a transmitend device and a receive end device are opposite to each other. In somecommunication processes, the communications device may serve as thefirst device, and has a function of a receive end. In some communicationprocesses, the communications device may serve as the second device, andhas a function of a transmit end. For example, two network devicestransmit information to each other, and each network device may not onlyserve as the second device to receive information, but also serve as thefirst device to send information. A communication manner is not limitedin this application.

Any one of the first device and the second device may be user equipmentor a communications chip that can be used for user equipment, may be anetwork device, or may be a communications chip that can be used for anetwork device. The first port is a port that is of the first device andthat supports two protocol types, and the second port is any port of thesecond device.

According to a third aspect, a communications device is provided,including a transceiver unit and a processing unit, to perform themethod according to any possible implementation of the first aspect, orthe communications device is configured to perform the method accordingto any possible implementation of the second aspect. The transceiverunit is configured to perform functions related to sending andreceiving. Optionally, the transceiver unit includes a receiving unitand a sending unit. In a design, the communications device is acommunications chip, the receiving unit may be an input circuit or porton the communications chip, and the sending unit may be an outputcircuit or port on the communications chip.

In another design, the sending unit may be a transmitter. In anotherdesign, the receiving unit may be a receiver.

Optionally, the communications device further includes modulesconfigured to perform the communication method according to any possibleimplementation of the first aspect; or optionally, the communicationsdevice further includes modules configured to perform the communicationmethod according to any possible implementation of the second aspect.

According to a fourth aspect, a communications device is provided,including a processor, a memory, and a transceiver. The memory isconfigured to store a computer program, and the processor is configuredto invoke the computer program from the memory and run the computerprogram, so that the communications device performs the method accordingto any possible implementation of the first aspect, or thecommunications device is configured to perform the method according toany possible implementation of the second aspect.

Optionally, there is one or more processors, and there is one or morememories.

Optionally, the memory may be integrated with the processor, or thememory and the processor are disposed separately.

Optionally, the transceiver may include a transmitter (transmitter) anda receiver (receiver).

According to a fifth aspect, a system is provided, and the systemincludes the first device and the second device.

According to a sixth aspect, a communications device is provided, and asystem includes the first device and the second device.

According to a seventh aspect, a computer program product is provided,and the computer program product includes a computer program (alsoreferred to as code or an instruction). When the computer program runs,a computer performs the method according to any possible implementationof the first aspect, or a computer performs the method according to anypossible implementation of the second aspect.

According to an eighth aspect, a computer readable medium is provided,and the computer readable medium stores a computer program (alsoreferred to as code or an instruction). When the computer program runson a computer, the computer performs the method according to anypossible implementation of the first aspect, or the computer performsthe method according to any possible implementation of the secondaspect.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a schematic architectural diagram of a communications systemto which an embodiment of this application is applied;

FIG. 2 is a schematic structural diagram of information transmissionbetween ports that is applicable to an embodiment of this application;

FIG. 3 is a schematic diagram of an internal structure of a portsupporting a standard Ethernet protocol and a flexible Ethernet protocolaccording to an embodiment of this application:

FIG. 4 is a schematic structural diagram of a frame format of a standardEthernet protocol according to an embodiment of this application;

FIG. 5 is a schematic structural diagram of a frame format of a flexibleEthernet protocol according to an embodiment of this application;

FIG. 6 is a schematic flowchart of a communication method according toan embodiment of this application:

FIG. 7 is a schematic flowchart of a communication method according toan embodiment of this application:

FIG. 8 is a schematic diagram of a communication method according to anembodiment of this application;

FIG. 9 is a schematic structural diagram of an ordered set code blockaccording to an embodiment of this application;

FIG. 10 is a schematic diagram of a coded ordered set code blockaccording to an embodiment of this application;

FIG. 11 is a schematic diagram of a capability ordered set of indicationinformation indicating a protocol type supported by a port, and aschematic diagram of a status ordered set indicating a protocol typecurrently used by the port in a sending direction according to anembodiment of this application;

FIG. 12 is a schematic diagram of a capability ordered set of indicationinformation indicating a protocol type supported by a port, and aschematic diagram of a status ordered set indicating a protocol typecurrently used by the port in a sending direction according to anembodiment of this application:

FIG. 13 is a schematic diagram of a capability ordered set of indicationinformation indicating a protocol type supported by a port, and aschematic diagram of a status ordered set indicating a protocol typecurrently used by the port in a sending direction according to anembodiment of this application;

FIG. 14 is a schematic flowchart of another communication methodaccording to an embodiment of this application;

FIG. 15 is a schematic flowchart of another communication methodaccording to an embodiment of this application;

FIG. 16 is a schematic diagram of an LLDP packet according to anembodiment of this application;

FIG. 17 is a schematic flowchart of a communication method according toan embodiment of this application;

FIG. 18 is a schematic structural diagram of a communications deviceaccording to an embodiment of this application;

FIG. 19 is a schematic structural diagram of a communications deviceaccording to an embodiment of this application:

FIG. 20 is a schematic structural diagram of a communications deviceaccording to an embodiment of this application;

FIG. 21 is a schematic structural diagram of a communications deviceaccording to an embodiment of this application; and

FIG. 22 is a schematic structural diagram of a network device accordingto an embodiment of this application.

DESCRIPTION OF EMBODIMENTS

FIG. 1 is a schematic architectural diagram of a communications systemto which an embodiment of this application is applied. As shown in FIG.1, the communications system 1100 may include a first device 1101 and asecond device 1201. Any one of the first device 1101 and the seconddevice 1201 may include one or more ports. Any port of the device maysupport only a standard Ethernet protocol, may support only a flexibleEthernet protocol, or may support both a standard Ethernet protocol anda flexible Ethernet protocol. As shown in FIG. 1, in the first device1101, a port 1103 supports the standard Ethernet protocol, a port 1104and a port 1105 support both the standard Ethernet protocol and theflexible Ethernet protocol, and a port 1106, a port 1107, and a port1108 support the flexible Ethernet protocol. Still as shown in FIG. 1,in the second device 1201, a port 1203 supports the standard Ethernetprotocol, a port 1204 and a port 1205 support both the standard Ethernetprotocol and the flexible Ethernet protocol, and a port 1206 supportsthe flexible Ethernet protocol. A port supporting both the standardEthernet protocol and the flexible Ethernet protocol may also bereferred to a port supporting a dual mode. A port supporting only thestandard Ethernet protocol may be referred to as a port supporting asingle mode. A port supporting only the flexible Ethernet protocol mayalso be referred to as a port supporting a single mode.

The ports of the first device and the second device in this embodimentof this application may also be referred to as Ethernet ports. The portsmay be connected to each other, for example, in FIG. 1, the port 1103 ofthe first device 1101 is connected to the port 1203. The port 1107 andthe port 1108 of the first device 1101 may be connected to anotherdevice, or may be temporarily empty. “Empty” may mean that the port isnot connected to another device, or may mean that the port is connectedto another device but a link is not enabled. Usually, one port may beconnected to another port, that is, a transmission link is established.Optionally, one port may be connected to a plurality of ports, and aplurality of transmission links exist. This is not limited in thisembodiment of this application. In this embodiment of this application,a transmission link constituted by two ports is used as an example fordescription. When a plurality of links exist, for two portscorresponding to each link, refer to the solution provided in thisembodiment of this application.

As shown in FIG. 1, in this embodiment of this application, any one ofthe first device 1101 and the second device 1201 may include amanagement module, such as a management module 1102 in the first device1101 and a management module 1202 in the second device 1201. Themanagement module may obtain a protocol type supported by each of allports of the device, and may also obtain a protocol type supported by apeer port connected to the port. For example, the management module mayobtain a protocol supported by the port 1103, and may also obtain aprotocol type supported by the peer port 1203 connected to the port1103. Further, the management module may further receive informationentered externally, and may further determine, based on the informationentered externally, a protocol type used to send information and receiveinformation by a port supporting two protocol types. Optionally, themanagement module subsequently may also configure, based on a protocoltype supported by a port, a protocol type used by the port when the portsends information and receives information.

In this embodiment of this application, information may be mutuallytransmitted between ports. FIG. 2 shows an example of a schematicstructural diagram of information transmission between ports that isapplicable to an embodiment of this application. As shown in FIG. 2, theport 1104 may both send information and receive information, and theport 1204 may both send information and receive information. When theport 1104 and the port 1204 are connected, the first device 1101 maysend information to the port 1204 through the port 1104, and the seconddevice 1201 may also send information to the port 1104 through the port1204.

Further, as shown in FIG. 2, in this embodiment of this application,when a port supports two protocol types, a protocol type used by theport to send information may be different from or the same as a protocoltype used by the port to receive information. For example, if theprotocol type used by the port to send information is the standardEthernet protocol, the port sends information according to the standardEthernet protocol; and if the protocol type used by the port to receiveinformation is the flexible Ethernet protocol, the port receivesinformation according to the flexible Ethernet protocol. Specifically,when the port sends information according to the standard Ethernetprotocol, the sent information complies with the standard Ethernetprotocol, and a port that receives the information may parse theinformation according to the standard Ethernet protocol. Alternatively,when the port sends information according to the flexible Ethernetprotocol, the sent information complies with the flexible Ethernetprotocol, and a port that receives the information may parse theinformation according to the flexible Ethernet protocol. In addition,when receiving information according to the standard Ethernet protocol,the port parses the received information according to the standardEthernet protocol. Alternatively, when receiving information accordingto the flexible Ethernet protocol, the port parses the receivedinformation according to the flexible Ethernet protocol.

In this embodiment of this application, the first device 1101 and thesecond device 1201 may communicate with each other. Any one of the firstdevice and the second device may communicate with one or more corenetworks by using a radio access network (Radio Access Network, RAN forshort). The device may be user equipment or a chip that can be disposedin user equipment. In this embodiment of this application, the firstdevice 1101 and the second device 1201 may communicate with each other.Any one of the first device and the second device may be a networkdevice or a chip disposed in a network device. The device includes butis not limited to a base station (for example, a NodeB (NodeB), anevolved NodeB eNodeB, or a network device (for example, a transmissionpoint (transmission point, TP), a transmission and reception point(transmission reception point, TRP), a base station, or a small celldevice) in a fifth generation (the fifth generation, 5G) communicationssystem), a network device in a future communications system, or anaccess node, a wireless relay node, or a wireless backhaul node in aWiFi system.

FIG. 3 shows an example of a schematic diagram of an internal structureof a port supporting a standard Ethernet protocol and a flexibleEthernet protocol according to an embodiment of this application. Theport may include a physical layer (Physical, PHY), a mode conversionmodule (which may be referred to as a “mode switch” in English), aflexible Ethernet layer (FlexE shim), a flexible Ethernet client (FlexEClients), a flexible Ethernet overhead (FlexE Overhead. FlexE OH), areconciliation sublayer (Reconciliation Sublayer, RS), and a mediumaccess control (Medium Access Control, MAC) layer. If the port sendsinformation according to the standard Ethernet protocol, a flowdirection of the information may be sequentially MAC layer-RS-modeconversion module-physical layer. When the port receives informationaccording to the flexible Ethernet protocol, a flow direction of theinformation may be sequentially MAC layer-RS-flexible Ethernet client orflexible Ethernet overhead-flexible Ethernet layer-mode conversionmodule-physical layer. If the port receives information according to thestandard Ethernet protocol, a flow direction of the information may besequentially physical layer-mode conversion module-RS-MAC layer. Whenthe port receives information according to the flexible Ethernetprotocol, a flow direction of the information may be sequentiallyphysical layer-mode conversion module-flexible Ethernet layer-flexibleEthernet client or flexible Ethernet overhead-RS-MAC layer. The flexibleEthernet client and the flexible Ethernet overhead are two modes. Forexample, a flexible Ethernet client channel is used to carry a servicepacket, and a flexible Ethernet overhead channel is used to specificallycarry a management packet.

As shown in FIG. 3, optionally, the mode conversion module is configuredto implement conversion between two types of protocols. The modeconversion module may further identify some received information, forexample, the mode conversion module may identify indication informationused to indicate a protocol type supported by a second port of a seconddevice, or may identify indication information used to indicate aprotocol type currently used by a second port of a second device to sendinformation, for example, the indication information is some specialmark code blocks (FlexE OH code blocks or other customized feature codeblocks).

In the standard Ethernet protocol, bandwidth of a port is not divided interms of time division multiplexing, and a complete physical link may bemultiplexed to collect statistics about service data packets, managementprotocol packets, and operation, administration and maintenance(Operations, Administration, and Maintenance, OAM) protocol packets.FIG. 4 shows an example of a schematic structural diagram of a frameformat of a standard Ethernet protocol according to an embodiment ofthis application. As shown in FIG. 4, the frame format includes adestination address (Destination Address, DA), a source address (SourceAddress, SA), a type (Type), data (Data), and a frame check sequence(frame check sequence, FCS). A management protocol packet and an OAMprotocol packet usually may be distinguished from the service datapacket by using a special layer-2 MAC address, a packet type, and thelike.

FIG. 5 shows an example of a schematic structural diagram of a frameformat of a flexible Ethernet protocol according to an embodiment ofthis application. As shown in FIG. 5, a fixed frame format may beconstructed based on the flexible Ethernet protocol for transmissionthrough a physical port, and slot division is performed based on timedivision multiplexing (Time Division Multiplexing, TDM). A slot divisiongranularity of a FlexE may be 66B, and correspondingly carries a 64B/66Bcode block. For a 100 GE PHY port, a data code block stream may include20 64B/66B code blocks and correspond to 20 slots. Each slot has abandwidth of 5G and 5G is referred to as one slot (slot). In thisembodiment of this application, 64B/66B may be understood as 64-bit bitblocks and 66-bit code blocks that are obtained by coding the 64-bit bitblocks.

As shown in FIG. 5, the flexible Ethernet may construct a time divisionmultiplexing frame structure based on a 64B/66B code block. Data at eachPHY in the FlexE is aligned by periodically inserting a FlexE overhead(Overhead, OH) code block. For example, one 66B overhead code blockFlexE OH may be inserted every 1023×20 66B payload data code blocks. Asshown in FIG. 5, 66B code blocks in eight rows (each row includes one OHcode block+1023×20 data (Data)) constitute a protocol frame of theflexible Ethernet protocol, as shown in FIG. 5; and 32 protocol framesof the flexible Ethernet protocol constitute a multiframe of theflexible Ethernet protocol. In a possible implementation solution, inthe first OH code block in the protocol frame of the flexible Ethernetprotocol, a 0x4B field of bits 0 to 7 and a 0x5 field of bits 32 to 35jointly constitute a frame header indication mark field of a FlexE frameoverhead code block. In the FlexE OH, two management channels may bedefined, and the management channel may be used to run a managementcommunication link and an OAM communication link of a 1.2 Mb/s Ethernetprotocol and a 1.8 Mb/s Ethernet protocol that are coded based on a64B/66B code block sequence. Further, in this embodiment of thisapplication, 64B/66B coding may be used in a scenario of a 100 GEphysical layer.

Ports supporting different protocol types may have a same physicalappearance attribute, but because of different management channels andmechanisms, a port supporting only a standard Ethernet protocol and aport supporting only a flexible Ethernet protocol do not have acapability of adapting to a state of the peer end and cannot communicatewith each other. To be further compatible with a standard Ethernet, aport supporting the flexible Ethernet protocol and the standard Ethernetprotocol may be configured. This embodiment of this application providesa solution, so that a port supporting both the flexible Ethernetprotocol and the standard Ethernet protocol can obtain a protocol typesupported by a peer port, and can further communicate with the peer portbased on the protocol type supported by the port and the protocol typesupported by the peer port. FIG. 6 shows an example of a schematicflowchart of a communication method according to an embodiment of thisapplication. As shown in FIG. 6, the method includes the followingsteps.

Step 2101: A first device obtains a protocol type supported by a secondport of a second device, where the protocol type supported by the secondport of the second device includes a flexible Ethernet protocol and/or astandard Ethernet protocol, and a first port of the first devicesupports the flexible Ethernet protocol and the standard Ethernetprotocol.

Step 2102: The first device determines a target protocol type based onthe protocol type supported by the second port and a protocol typesupported by the first port, where the target protocol type includes theflexible Ethernet protocol or the standard Ethernet protocol.

Step 2103: The first device communicates with the second device based onthe target protocol type through the first port and the second port.

In this embodiment of this application, the port of the first devicesupports the flexible Ethernet protocol and the standard Ethernetprotocol, and the protocol type supported by the port of the seconddevice includes the flexible Ethernet protocol and/or the standardEthernet protocol. The first device obtains the protocol type supportedby the port of the second device, determines the target protocol typebased on the protocol type supported by the port of the second deviceand the protocol type supported by the port of the first device, andcommunicates with the second device based on the target protocol type.The target protocol type includes the flexible Ethernet protocol or thestandard Ethernet protocol. In this way, communication between anotherport and a port supporting both the flexible Ethernet protocol and thestandard Ethernet protocol is implemented.

It may be learned by a person skilled in the art that if a new protocoltype appears in the future, based on the solution provided in thisembodiment of this application, the target protocol type may be furtherdetermined based on a protocol type supported by the local port and aprotocol type supported by a peer port.

In step 2101, the first device obtains, in a plurality of manners, theprotocol type supported by the second port of the second device, forexample, the protocol type is configured in a system in advance, orexternal management personnel enters the protocol type. FIG. 7 shows anexample of a schematic flowchart of a communication method according toan embodiment of this application. As shown in FIG. 7, the methodincludes the following steps:

Step 2201: A second device generates indication information used toindicate a protocol type supported by a second port of the seconddevice, where the protocol type supported by the second port of thesecond device includes a flexible Ethernet protocol and/or a standardEthernet protocol.

Step 2202: The second device sends the indication information used toindicate the protocol type supported by the second port.

When a first device includes one or more ports, a first port is any portthat is of the first device and that supports both the flexible Ethernetprotocol and the standard Ethernet protocol. The second port is any portof the second device. The second port may support only the flexibleEthernet protocol, or may support only the standard Ethernet protocol,or may support both the flexible Ethernet protocol and the standardEthernet protocol. Each port in this embodiment of this application hasa sending capability and a receiving capability. When the port sendsinformation, for a related solution, refer to a related solution of thesecond port in this embodiment of this application. When the port cansupport both the flexible Ethernet protocol and the standard Ethernetprotocol, for a related solution in which the port receives information,refer to a related solution of the first port in this embodiment of thisapplication.

To be specific, the solution provided in this embodiment of thisapplication and performed by the first port may be applied to any portthat can support both the flexible Ethernet protocol and the standardEthernet protocol. The solution provided in this embodiment of thisapplication and performed by the second port may be applied to any port.In other words, any port can perform the solution related to the secondport in this embodiment of this application, and any port supportingboth the flexible Ethernet protocol and the standard Ethernet protocolcan perform the solution related to the first port in this embodiment ofthis application.

In an optional implementation, if the second port supports the flexibleEthernet protocol and the standard Ethernet protocol, the second portmay also obtain a protocol type supported by the first port; determine atarget protocol type based on the protocol type supported by the secondport and the protocol type supported by the first port, where the targetprotocol type includes the flexible Ethernet protocol or the standardEthernet protocol; and further communicate with the second device basedon the target protocol type through the first port and the second port.Optionally, a related solution in which the second port obtains theprotocol type supported by the first port is similar to a solution inwhich the first port obtains the protocol type supported by the secondport. Details are not described herein again.

In another optional implementation, the first device generatesindication information used to indicate a protocol type supported by thefirst port; and the first device sends the indication information usedto indicate the protocol type supported by the first port. Optionally, arelated solution in which the first port sends the indicationinformation used to indicate the protocol type supported by the firstport is similar to a solution in which the second port sends theindication information used to indicate the protocol type supported bythe second port. Details are not described herein again.

In an optional implementation, after the first device determines atarget protocol type, the first device sends information to the secondport of the second device based on the target protocol type through thefirst port, so that the second port can successfully parse theinformation sent from the first port. In another optionalimplementation, after the first device determines a target protocoltype, the first device receives, based on the target protocol typethrough the first port, information sent from the second port of thesecond device, so that the first port can successfully parse theinformation sent from the second port. In a third optionalimplementation solution, the first device sends information to thesecond port of the second device based on a target protocol type throughthe first port, and receives, based on the target protocol type throughthe first port, information sent from the second port of the seconddevice, so that a protocol type used by the first port to sendinformation is consistent with a protocol type used by the first port toreceive information. Therefore, the first port better communicates withthe second port, and the first port and the second port are also easilymanaged.

Further, in this embodiment of this application, before the first devicedetermines the target protocol type, the method further includes: Thefirst device obtains, by using a physical coding sublayer (PhysicalCoding Sublayer, PCS) code block, a protocol type currently used by thesecond port to send information. The PCS code block is a general term,and has no specified meaning. Specifically, the first device obtains, byusing related information at a PCS layer, the protocol type currentlyused by the second port to send information. The PCS code block may bedata information, or may be error information, link information, or thelike. Because the PCS layer is a relatively low layer, time overheadscan be reduced in a manner of obtaining information by using PCS layersignaling. In an optional implementation, the second device sends, byusing a PCS code block, indication information used to indicate aprotocol type currently used by the second port to send information. Forexample, the second device adds, to the PCS code block, the indicationinformation used to indicate the protocol type currently used by thesecond port to send information. Because the first device obtains theprotocol type currently used by the second port to send information, thefirst device may adaptively adjust a protocol type currently used by thefirst device to receive information, thereby laying a foundation forsuccessfully parsing higher layer signaling subsequently. Further, in apossible implementation, the standard Ethernet protocol and the flexibleEthernet protocol are completely the same in terms of a physicalarchitecture at a layer lower than the PCS layer, and both are 64B/66Bcode block streams on a data plane. Therefore, when two ports transmitinformation to each other by using the PCS code block, PCS layerinformation can still be parsed even if protocol types used by the twoports are different. Based on this, in this embodiment of thisapplication, information is transmitted by using the PCS code block, sothat a port using the flexible Ethernet protocol can perform PCS layerparsing on received information sent by using the standard Ethernetprotocol, and a port using the standard Ethernet protocol can performPCS layer parsing on received information sent by using the flexibleEthernet protocol. Therefore, the two ports supporting differentprotocols communicate with each other.

In an optional implementation solution provided in this embodiment ofthis application, the sending, by the second device by using a physicalcoding sublayer PCS code block, indication information used to indicatea protocol type currently used by the second port to send informationincludes: sending, by the second device, a first preset PCS code blockwhen the protocol type currently used by the second port to sendinformation is the flexible Ethernet protocol. Further, optionally, whenthe protocol type currently used by the second port to send informationis the standard Ethernet protocol, the second device may not send afirst preset PCS code block, or may send other information such as athird preset PCS code block used to indicate the standard Ethernetprotocol. Alternatively, the second device sends a third preset PCS codeblock when the protocol type currently used by the second port to sendinformation is the standard Ethernet protocol. In this way, the firstport may determine, by determining whether the first preset PCS codeblock is received, the protocol type currently used by the second portto send information. This reduces time overheads and is also simple andfast. Optionally, a reserved bit in a code block in the prior art may bemultiplexed for the first preset PCS code block, or some code blocks maybe newly defined.

In another corresponding optional implementation, the obtaining, by thefirst device by using a first PCS code block, a protocol type currentlyused by the second port to send information includes: when a firstpreset PCS code block is received, determining, by the first device,that the protocol type currently used by the second port to sendinformation is the flexible Ethernet protocol; or when a first presetPCS code block is not received, determining, by the first device, thatthe protocol type currently used by the second port to send informationis the standard Ethernet protocol. There are a plurality of specificdetermining manners. For example, if it is determined that informationreceived by the first port does not include the first preset PCS codeblock, or if it is found that information received by the first portincludes a third preset PCS code block, it may be determined that theprotocol type currently used by the second port to send information isthe standard Ethernet protocol. In this way, the first port mayconveniently and quickly determine the protocol type currently used bythe second port to send information.

Further, in this embodiment of this application, optionally, theprotocol type supported by the second port includes the flexibleEthernet protocol and the standard Ethernet protocol, and the methodfurther includes: sending, by the second device, first indicationinformation; or sending, by the second device, first indicationinformation and second indication information. The first indicationinformation is used to indicate a protocol type with a higher priorityin the protocol type supported by the second port, and the secondindication information is used to indicate a priority level of theprotocol type with a higher priority in the protocol type supported bythe second port. In an optional implementation, the protocol typesupported by the second port of the second device includes the flexibleEthernet protocol and the standard Ethernet protocol; the first deviceobtains first indication information; and the first device determinesthe target protocol type based on the first indication information andthe protocol type supported by the first port of the first device.

For example, the protocol type with a higher priority in the protocoltype supported by the second port is a flexible Ethernet protocol type.In this case, the flexible Ethernet protocol may be selected as thetarget protocol type of the first port. Further, optionally, afterobtaining the protocol type supported by the first port, the second portdetermines, based on the protocol types supported by the first port andthe second port and the protocol type with a higher priority in theprotocol type supported by the second port, that the target protocoltype of the second port is also the flexible Ethernet protocol.Therefore, it may be learned that the first port and the second portdetermine a same target protocol type, so that the first port and thesecond port may communicate with each other based on the target protocoltype.

In an optional implementation, the protocol type supported by the secondport of the second device includes the flexible Ethernet protocol andthe standard Ethernet protocol; the first device obtains firstindication information; and the first device determines the targetprotocol type based on the first indication information and a protocoltype with a higher priority in the protocol type supported by the firstport of the first device.

For example, the protocol type with a higher priority in the protocoltype supported by the first port is a flexible Ethernet protocol type,and a protocol type with a higher priority in the protocol typesupported by the second port is a flexible Ethernet protocol type. Itmay be learned that the first port and the second port support a sameprotocol type with a higher priority. Therefore, the target protocoltype selected by the first port is the flexible Ethernet protocol.Further, optionally, after the second port obtains the protocol typesupported by the first port, the correspondingly determined targetprotocol type of the second port is also the flexible Ethernet protocol.Therefore, it may be learned that the first port and the second portdetermine a same target protocol type, so that the first port and thesecond port may communicate with each other based on the target protocoltype.

For another example, the protocol type with a higher priority in theprotocol type supported by the first port is a flexible Ethernetprotocol type, and a protocol type with a higher priority in theprotocol type supported by the second port is a standard Ethernetprotocol type. It may be learned that the first port and the second portsupport different protocol types with a higher priority. In this case,the target protocol type may be selected according to some preset rules.For example, a preset rule may be selecting the flexible Ethernetprotocol when the first port and the second port support differentprotocol types with a higher priority.

In a third optional implementation, before the first device determinesthe target protocol type based on the protocol type supported by thesecond port of the second device and the protocol type supported by thesecond port of the first device, the method further includes: obtaining,by the first device, second indication information; and determining, bythe first device, the target protocol type based on first indicationinformation, the second indication information, a protocol type with ahigher priority in the protocol type supported by the first port of thefirst device, and a priority level of the protocol type with a higherpriority in the protocol type supported by the first port of the firstdevice. A priority level in this embodiment of this application is usedto indicate a priority degree of a protocol type. For example, a level 0to a level 3 may be set, the level 0 indicates a lowest priority degree,and the level 3 indicates a highest priority degree.

For example, the protocol type with a higher priority in the protocoltype supported by the first port is a flexible Ethernet protocol type,and the priority level of the protocol type with a higher priority inthe protocol type supported by the first port is the level 3; and aprotocol type with a higher priority in the protocol type supported bythe second port is a standard Ethernet protocol type, and a prioritylevel of the protocol type with a higher priority in the protocol typesupported by the second port is the level 3. It may be learned that thefirst port and the second port support different protocol types with ahigher priority, and the protocol types with a higher priority in theprotocol types that are supported by the first port and the second porthave a same priority level. In this case, the target protocol type maybe determined according to some preset rules. For example, a preset rulemay be selecting the flexible Ethernet protocol when the first port andthe second port support different protocol types with a higher priority,and the protocol types with a higher priority in the protocol types thatare supported by the first port and the second port have a same prioritylevel.

For another example, the protocol type with a higher priority in theprotocol type supported by the first port is a flexible Ethernetprotocol type, and the priority level of the protocol type with a higherpriority in the protocol type supported by the first port is the level3; and a protocol type with a higher priority in the protocol typesupported by the second port is a standard Ethernet protocol type, and apriority level of the protocol type with a higher priority in theprotocol type supported by the second port is a level 2. It may belearned that the first port and the second port support differentprotocol types with a higher priority, and the priority level of theprotocol type with a higher priority in the protocol type supported bythe first port is higher. Therefore, the target protocol type determinedby the first port is the flexible Ethernet protocol. Further,optionally, after the second port obtains the protocol type supported bythe first port, the target protocol type, of the second port, that isdetermined based on priority levels supported by the first port and thesecond port is also the flexible Ethernet protocol. Therefore, it may belearned that the first port and the second port determine a same targetprotocol type, so that the first port and the second port maycommunicate with each other based on the target protocol type.

Based on the foregoing content, this embodiment of this applicationprovides an optional implementation. The obtaining, by a first device, aprotocol type supported by a second port of a second device includes:obtaining, by the first device by using a second PCS code block, theprotocol type supported by the second port. To be specific, theindication information used to indicate the protocol type supported bythe second port is carried in the PCS code block. Therefore, when twoports transmit information to each other by using the PCS code block,PCS layer information can still be parsed even if protocol types used bythe two ports are different. Based on this, in this embodiment of thisapplication, the indication information used to indicate the protocoltype supported by the second port is transmitted by using the PCS codeblock. Even if a protocol type used by the first port to receiveinformation is different from a protocol type used by the second port tosend information, the first port can still successfully obtain, throughparsing, the indication information that is sent by the second port byusing the PCS code block and that is used to indicate the protocol typesupported by the second port, so that the first port successfullyobtains the protocol type supported by the second port.

Further, in an optional implementation, specific characters are set infixed fields in some PCS code blocks, to indicate the protocol typesupported by the second port. For example, if the field is 1, itindicates that the protocol type supported by the second port includesthe flexible Ethernet protocol; if the field is 0, it indicates that theprotocol type supported by the second port includes the flexibleEthernet protocol and the standard Ethernet protocol; or if the field isempty, it indicates that the protocol type supported by the second portincludes the standard Ethernet protocol.

This embodiment of this application provides an optional implementationsolution to reduce time overheads. The sending, by the second device,the indication information used to indicate the protocol type supportedby the second port of the second device includes at least one of thefollowing content: when the second port of the second device supportsthe flexible Ethernet protocol and the standard Ethernet protocol,sending information including the second preset PCS code block; when thesecond port of the second device supports the flexible Ethernetprotocol, sending information that does not include the second presetPCS code block and includes the first preset PCS code block; or when thesecond port of the second device supports the standard Ethernetprotocol, sending information including neither the second preset PCScode block nor the first preset PCS code block. Correspondingly, in anoptional implementation, the obtaining, by a first device, a protocoltype supported by a second port of a second device includes at least oneof the following content: when the second preset PCS code block isreceived, determining, by the first device, that the protocol typesupported by the second port includes the flexible Ethernet protocol andthe standard Ethernet protocol; when the second preset PCS code block isnot received and the first preset PCS code block is received,determining, by the first device, that the protocol type supported bythe second port is the flexible Ethernet protocol; or when neither thesecond preset PCS code block nor the first preset PCS code block isreceived, determining, by the first device, that the protocol typesupported by the second port is the standard Ethernet protocol. In thisway, the first port may determine, by using the first preset PCS codeblock and the second preset PCS code block, the protocol type supportedby the second port. This is simple and fast, and can reduce timeoverheads.

In another optional implementation solution, the sending, by the seconddevice, the indication information used to indicate the protocol typesupported by the second port of the second device includes at least oneof the following content: when the second port of the second devicesupports the flexible Ethernet protocol and the standard Ethernetprotocol, sending information including the second preset PCS codeblock; when the second port of the second device supports the flexibleEthernet protocol, sending information including the first preset PCScode block; or when the second port of the second device supports thestandard Ethernet protocol, sending information including neither thesecond preset PCS code block nor the first preset PCS code block, wherefor example, information including the third preset PCS code block maybe sent. Correspondingly, in an optional implementation, the obtaining,by a first device, a protocol type supported by a second port of asecond device includes at least one of the following content: when thesecond preset PCS code block is received, determining, by the firstdevice, that the protocol type supported by the second port includes theflexible Ethernet protocol and the standard Ethernet protocol; when thefirst preset PCS code block is received, determining, by the firstdevice, that the protocol type supported by the second port is theflexible Ethernet protocol; or when neither the second preset PCS codeblock nor the first preset PCS code block is received, determining, bythe first device, that the protocol type supported by the second port isthe standard Ethernet protocol. In this way, the first port maydetermine, by using the first preset PCS code block and the secondpreset PCS code block, the protocol type supported by the second port.This is simple and fast, and can reduce time overheads.

FIG. 8 shows an example of a schematic diagram of a communication methodaccording to an embodiment of this application. As shown in FIG. 8, themethod includes the following steps:

Step 2301: Determine whether a first port receives a second preset PCScode block; and perform step 2302 if the first port receives the secondpreset PCS code block; or perform step 2303 if the first port does notreceive the second preset PCS code block.

Step 2302: Determine that a protocol type supported by a second portincludes a flexible Ethernet protocol and a standard Ethernet protocol.

Step 2303: Determine whether the first port receives a first preset PCScode block; and perform step 2304 if the first port receives the firstpreset PCS code block; or perform step 2305 if the first port does notreceive the first preset PCS code block.

Step 2304: Determine that the protocol type supported by the second portis a flexible Ethernet protocol.

Step 2305: Determine that the protocol type supported by the second portis a standard Ethernet protocol.

In the foregoing embodiment, the first preset PCS code block may includean OH frame header code block of the flexible Ethernet protocol. To bespecific, the first preset PCS code block may be the overhead (OH) frameheader code block of the flexible Ethernet protocol in FIG. 5, and theoverhead (OH) frame header code block of the flexible Ethernet protocolmay also be described as a FlexE OH 0x4B+0x5 code block. For othercorresponding descriptions, refer to the foregoing content. For anotherexample, the first preset PCS code block may also be in another form,for example, a field and a specific character are preset. If thecharacter is received in the field, it is determined that the firstpreset PCS code block is received; or if the character is not receivedin the field, it is determined that the first preset PCS code block isnot received.

In an optional implementation, the second preset PCS code block may benewly defined. To minimize modifications to the prior art, thisembodiment of this application provides an implementation solution ofthe second preset PCS code block. The second preset PCS code block is anewly defined ordered set (ordered set) code block. The ordered set codeblock usually may meet content of “the ordered set code block is used toextend a capability of sending information about a control status and alink status, and the link status includes a remote fault state and alocal fault state”. In English, corresponding descriptions are contentdescribed in “ordered sets are used to extend the ability to sendcontrol and status information over the link such as remote fault andlocal fault status”. The ordered set code block may also be referred toas an interface mode ordered set. An English description of theinterface mode ordered set may be written as “interface mode orderedset”. To be specific, the second preset PCS code block may be an orderedset code block. The ordered set code block is redefined in thisembodiment of this application. In this embodiment of this application,the ordered set code block representing the second preset PCS code blockmay be referred to as a newly defined ordered set code block. The newlydefined ordered set code block is based on 64B/66B coding. The firstport may identify the first PCS code block and the second PCS codeblock, for example, identify the first PCS code block and the second PCScode block by using the mode conversion module in FIG. 3. The modeconversion module in FIG. 3 may be disposed at a physical layer.

FIG. 9 shows an example of a schematic structural diagram of an orderedset code block according to an embodiment of this application. As shownin FIG. 9, a last row is a newly defined ordered set code block, thatis, the last row is a second preset PCS code block, and a first port mayidentify the newly defined ordered set code block. Further, optionally,the foregoing first indication information and/or second indicationinformation may be carried in the ordered set code block. For example,the first two bits of a byte in a lane 2 in the last row identify thefirst indication information, that is, identity a protocol type with ahigher priority, which may be referred to as a “prior mode” in English.For example, if the two bits are 10, it indicates that a protocol typewith a higher priority and supported by a second port is a flexibleEthernet protocol; or if the two bits are 01, it indicates that aprotocol type with a higher priority and supported by a second port is astandard Ethernet protocol. Two bits following the first two bits mayidentify the second indication information, which may be referred to asa “priority” in English. Further, optionally, to extend a futureapplication scenario of this embodiment of this application, the lastfour bits may be used as reserved bits.

Further, the ordered set code block may be a code block including acontrol character and a data character, and may be used to send controlinformation and status information, such as “reserved (reserved)”,“local fault (local Fault)”, and “remote fault (remote Fault)” in a lastlane (Description) in the first three rows in the IEEE 802.3 standardsupporting 40 Gb/s and 100 Gb/s in FIG. 9. In addition, the newlydefined ordered set code block (the last row in FIG. 9) in thisembodiment of this application may be used to carry indicationinformation used to indicate a protocol type supported by the secondport. In the newly defined ordered set code block (the last row in FIG.9), a sequence in a lane 0 may be represented as a control code of 0x9C,and a value of the lane 2 may be determined by a prior mode and apriority. A lane 3 may be set to 0x03, and is a main identifier byte ofan ordered set. To be specific, the first port may identify the secondpreset PCS code block by identifying the lane 3. A last lane in the lastrow in FIG. 9 may be an interface mode.

FIG. 10 shows an example of a schematic diagram of a coded ordered setcode block according to an embodiment of this application. A linkbetween a first port and a second port is enabled. When a protocol typesupported by the second port includes a standard Ethernet protocol and aflexible Ethernet protocol, the second port sends a newly definedordered set code block (a last row shown in FIG. 9), and a PCS layer ofthe second port codes the newly defined ordered set code block into aform of a second row in FIG. 10, to notify the peer end of the protocoltype supported by the second port. In a possible coding manner, thesequence in the lane 0 in the last row in FIG. 9 is coded into a blocktype field 0x4B (bits 02 to 09 in the second row in FIG. 10); 0x00 inthe lane 1 is coded into D1; 0x?? in the lane 2 is coded into 0x??; 0x03in the lane 3 is coded into 0x03; and four 0x00 bytes in lanes 4 to 7are coded into 0x5 and 0x00_0000 that are of 34 to 65 bits. A third rowin FIG. 10 may represent a FlexE frame header code block.

In implementations provided in FIG. 8 to FIG. 10, optionally, a firstdevice obtains, by using a first physical coding sublayer PCS codeblock, a protocol type currently used by the second port to sendinformation. Optionally, the indication information used to indicate theprotocol type supported by the second port may also indicate theprotocol type currently used by the second port to send information. Forexample, when the second preset PCS code block is not received and thefirst preset PCS code block is received, the first device not only candetermine that the protocol type supported by the second port is theflexible Ethernet protocol, but also can determine that the protocoltype currently used by the second port to send information is theflexible Ethernet protocol. For another example, when neither the firstpreset PCS code block nor the second preset PCS code block is received,the first device not only can determine that the protocol type supportedby the second port is the standard Ethernet protocol, but also candetermine that the protocol type currently used by the second port tosend information is the standard Ethernet protocol. For another example,when the first preset PCS code block is not received and the secondpreset PCS code block is received, the first device not only candetermine that the protocol type supported by the second port is theflexible Ethernet protocol and the standard Ethernet protocol, but alsocan determine the protocol type currently used by the second port tosend information. For example, it is preset that when a link is enabled,a port supporting the flexible Ethernet protocol and the standardEthernet protocol uses, by default, the flexible Ethernet protocol tosend information. In this case, if the first preset PCS code block isnot received and the second preset PCS code block is received, the firstdevice determines that the protocol type currently used by the secondport to send information is a flexible protocol type. For anotherexample, if the second preset PCS code block carries the firstindication information, when the first preset PCS code block is notreceived and the second preset PCS code block is received, the firstdevice determines that the protocol type currently used by the secondport to send information is a protocol type with a higher priority andindicated by the first indication information.

This embodiment of this application provides another optionalimplementation. A sending ordered set (namely, an ordered set codeblock) in a sending direction of a transmitter of a port is based on anordered set extended in this application. In one aspect, the ordered setis used to notify a protocol type supported by the port, includingwhether the port can support the flexible Ethernet protocol and/or thestandard Ethernet protocol, specifically, whether the port supports aflexible Ethernet protocol (aware mode) capability, a flexible Ethernetprotocol (terminated mode) capability, and a standard Ethernet protocolcapability. The flexible Ethernet protocol (aware mode) capability maybe expressed as “FlexE Mode (aware) Capable” in English, the flexibleEthernet protocol (terminated mode) capability may be expressed as“FlexE Mode (terminated) Capable” in English, and the standard Ethernetprotocol (full-bandwidth MAC) capability may be expressed as “StdE Mode(Full BW MAC) Capable” in English. In another aspect, the ordered set isalso used to notify a protocol type currently used by the port in thesending direction (transmitter direction). The ordered set may include acapability ordered set and a status ordered set. The capability orderedset is indication information used to indicate the protocol typesupported by the port, and the status ordered set is indicationinformation used to indicate the protocol type currently used by theport in the sending direction. FIG. 11, FIG. 12, and FIG. 13 showexamples of schematic diagrams of a capability ordered set of indicationinformation indicating a protocol type supported by a port, andschematic diagrams of a status ordered set indicating a protocol typecurrently used by the port in a sending direction according to anembodiment of this application. As shown in FIG. 1, FIG. 12, and FIG.13:

When a capability ordered set sent by the second port is that FlexE Mode(aware)==0, FlexE Mode (terminated)==0, and StdE Mode (Full BW MAC)==1,it indicates that the protocol type supported by the second portincludes the standard Ethernet protocol, and further indicates that thesecond port can work in the standard Ethernet protocol (full-bandwidthMAC).

When a capability ordered set sent by the second port is that FlexE Mode(aware)==1, FlexE Mode (terminated)==0, and StdE Mode (Full BW MAC)==0,it indicates that the protocol type supported by the second portincludes the flexible Ethernet protocol. Specifically, the second portcan work in the flexible Ethernet protocol (aware mode) (that is, anaware FlexE can process some overheads but do not extract a customersignal).

When a capability ordered set sent by the second port is that FlexE Mode(aware)==1, FlexE Mode (terminated)==1, and StdE Mode (Full BW MAC)==0,it indicates that the protocol type supported by the second portincludes the flexible Ethernet protocol. Specifically, the second portcan work in the flexible Ethernet protocol (terminated mode) (that is, aterminated FlexE processes and terminates all overheads, and extracts acustomer signal).

When a capability ordered set sent by the second port is that FlexE Mode(aware)==1. FlexE Mode (terminated)==1, and StdE Mode (Full BW MAC)==1,it indicates that the protocol type supported by the second portincludes the flexible Ethernet protocol and the standard Ethernetprotocol. Specifically, the second port can work in the flexibleEthernet protocol (terminated mode) (that is, a terminated FlexEprocesses and terminates all overheads, and extracts a customer signal).In addition, the terminated FlexE can process and exchange customersignals in a packet processing manner in a conventional Ethernet.

Optionally, specifically, for the flexible Ethernet protocol, the portmay further define and notify a flexible Ethernet group capability token(FlexE Group Capability key). In this way, ports having a samecapability token may construct a FLexE group group; and ports havingdifferent capability tokens cannot construct a FLexE group. Optionally,the status ordered set may further be defined to notify the protocoltype currently used by the port in the sending direction. A meaning ofthis definition is similar to that of a capability set, and the statusordered set is used to indicate a current working state. Details are notdescribed again.

FIG. 14 shows an example of a schematic flowchart of anothercommunication method according to an embodiment of this application. Asshown in FIG. 14, the method includes the following steps.

Step 2401: A first device obtains a protocol type currently used by asecond port to send information. For a specific manner of obtaining theprotocol type currently used by the second port to send information,refer to the foregoing content. Details are not described herein again.

Step 2402: The first device receives, through a first port based on theobtained protocol type currently used by the second port to sendinformation, indication information used to indicate a protocol typesupported by the second port. For example, if the protocol typecurrently used by the second port to send information is a flexibleEthernet protocol, the first device receives, by using the flexibleEthernet protocol, the indication information used to indicate theprotocol type supported by the second port; or if the protocol typecurrently used by the second port to send information is a standardEthernet protocol, the first device receives, by using the standardEthernet protocol, the indication information used to indicate theprotocol type supported by the second port.

Optionally, the indication information used to indicate the protocoltype supported by the second port may be information carried in an LLDPpacket. In an optional implementation, the first port receives theindication information used to indicate the protocol type supported bythe second port, and may directly determine, based on the indicationinformation, the protocol type supported by the second port. In anotheroptional implementation, that the first port determines, based on theindication information used to indicate the protocol type supported bythe second port, the protocol type supported by the second portincludes: The first port determines whether the preset packet isreceived; and if the preset packet is received, determines, based oninformation in the preset packet, the protocol type supported by thesecond port; or if a preset packet is not received, directly determinesthat the protocol type supported by the second port is a standardEthernet protocol type. The preset packet may be an LLDP packet.

Step 2102: The first device determines a target protocol type based onthe protocol type supported by the second port and a protocol typesupported by the first port, where the target protocol type includes theflexible Ethernet protocol or the standard Ethernet protocol.

Step 2103: The first device communicates with a second device based onthe target protocol type through the first port and the second port.

In the solution shown in FIG. 14, a working state of the first port maybe actively adapted to a working state of the peer end, that is, aprotocol used by the first port to receive information is activelyadapted to a protocol used by the second port to send information.Therefore, a temporary session channel is established in step 2402, toprovide a basis for a next step of receiving the indication informationused to indicate the protocol type supported by the second port of thesecond device. In addition, the temporary channel is further created instep 2101, that is, a protocol type used by the first port to receiveinformation is the same as the protocol type currently used by thesecond port to send information. Therefore, the indication informationused to indicate the protocol type supported by the second port iscarried in a control packet at a medium access control MAC layer, or theindication information used to indicate the protocol type supported bythe second port is carried in a control packet at another layer higherthan a MAC layer. The first port can correctly obtain, through parsing,the indication information used to indicate the protocol type supportedby the second port. To be specific, in this embodiment of thisapplication, based on the created temporary channel, the indicationinformation used to indicate the protocol type supported by the secondport not only may be directly carried in the control packet at the MAClayer, but also may be nested in a packet, carried in the MAC controlpacket, of a higher layer protocol such as an internet protocol(Internet Protocol, IP), a transfer control protocol (Transfer ControlProtocol, TCP), or another protocol. This is not specifically limited.In an optional implementation, when the indication information used toindicate the protocol type supported by the second port is directlycarried in the MAC control packet, the indication information may be anextended type-length-value (Type-length-value, TLV) of a link layerdiscovery protocol (Link Layer Discovery Protocol, LLDP) capability(Capability) in this embodiment of this application. When the indicationinformation used to indicate the protocol type supported by the secondport is carried in any higher layer control protocol, the indicationinformation is encapsulated layer by layer in lower layers and isfinally encapsulated in the control packet at the MAC layer.

In an optional implementation, if the first port does not detect a FlexEOH frame header, the first port may determine that the protocol typecurrently used by the second port to send information is the standardEthernet protocol. In this case, the first port adjusts a protocol usedby the first port to receive information to the standard Ethernetprotocol, that is, the first port receives information according to thestandard Ethernet protocol. Further, the first port receives informationsent by the second port. The information indicates that a protocolsupported by the second port is the standard Ethernet protocol, and theinformation may be a packet of the standard Ethernet protocol (whichincludes a slow protocol such as the LLDP, that is, the second port doesnot send the extended LLDP TLV in this embodiment of this application,or the second port does not notify the first port of the unsupportedflexible Ethernet protocol). Therefore, the first port determines thatthe protocol supported by the second port is the standard Ethernetprotocol, that is, the second port is in a single mode. Further, thestandard Ethernet protocol may be determined as the target protocol typeof the first port.

In another optional implementation, if the first port detects a FlexE OHframe header, the first port may determine that the protocol typecurrently used by the second port to send information is the flexibleEthernet protocol. In this case, the first port adjusts a protocol usedby the first port to receive information to the flexible Ethernetprotocol, that is, the first port receives information according to theflexible Ethernet protocol. Further, the first port receives informationsent by the second port. The information indicates that the protocoltype supported by the second port is the flexible Ethernet protocol, andthe information may be the extended LLDP TLV in this embodiment of thisapplication and announce that the second port supports only the flexibleEthernet protocol. Therefore, the first port determines that theprotocol type supported by the second port is the flexible Ethernetprotocol, that is, the second port is in a single mode. Further, theflexible Ethernet protocol may be determined as the target protocol typeof the first port.

In a third optional implementation, both the first port and the secondport support two protocol types. When the first port and the second portare initialized, a protocol is randomly selected as a protocol to sendinformation and receive information. In this case, the following threescenarios may occur. In each of the three scenarios, a temporary channelcan be established, and the temporary channel may also be referred to asan LLDP unidirectional notification session. In a first possiblescenario, both the first port and the second port are enabled by usingthe flexible Ethernet protocol. In this way, the first port and thesecond port may perform a session such as an LLDP layer session based onthe flexible Ethernet protocol, so that the first port and the secondport may perform a capability notification temporary session over amanagement channel in a FlexE overhead. To be specific, the second portsends the indication information used to indicate the protocol typesupported by the second port. The indication information used toindicate the protocol type supported by the second port may be carriedin an LLDP packet.

In a second possible scenario, both the first port and the second portare enabled by using the standard Ethernet protocol. In this way, thefirst port and the second port may perform a session such as an LLDPlayer session based on the standard Ethernet protocol, and perform acapability notification temporary session in an StdE mode. Therefore,the second port may send the indication information used to indicate theprotocol type supported by the second port. The indication informationused to indicate the protocol type supported by the second port may becarried in an LLDP packet.

In a third possible scenario, the first port is enabled by using theflexible Ethernet protocol, and the second port is enabled by using thestandard Ethernet protocol. In this way, the first port and the secondport may perform an asymmetric unidirectional temporary session in aselected mode. For example, the first port adjusts a protocol used toreceive information to the standard Ethernet protocol, and the secondport adjusts a protocol used to receive information to the flexibleEthernet protocol. However, a protocol used by the first port to sendinformation is still the flexible Ethernet protocol, and a protocol usedby the second port to send information is still the standard Ethernetprotocol. In this way, the first port and the second port may send LLDPpackets to each other, to notify each other of respectively supportedprotocol types.

In this embodiment of this application, if both the first port and thesecond port support two protocol types, when the first port furtherdetermines the target protocol type of the first port, the first portuses a solution consistent with a solution in which the second portfurther determines a target protocol type of the second port. Forexample, both the first port and the second port comply with some samerules. For example, the ports supporting two types of protocols bothdetermine the flexible Ethernet protocol as the target protocol type.For another example, the ports supporting two types of protocols bothdetermine the standard Ethernet protocol as the target protocol type.For another example, the ports supporting two types of protocols bothdetermine the target protocol type with reference to the firstindication information and the second indication information. Foranother example, the ports supporting two types of protocols bothdetermine the target protocol type according to a rule such as a serviceor an actual application scenario. The target protocol type may beperiodically updated or aperiodically updated based on a service,external input information, an actual application scenario, or the likein subsequent work of the port.

To further reduce time overheads, FIG. 15 shows an example of aschematic flowchart of another communication method according to anembodiment of this application. In this example, a preset protocol typeincludes a flexible Ethernet protocol, and a non-preset protocol typeincludes a standard Ethernet protocol; or a preset protocol typeincludes a standard Ethernet protocol, and a non-preset protocol typeincludes a flexible Ethernet protocol. As shown in FIG. 15, the methodincludes the following steps.

Step 2501: A first device obtains a protocol type currently used by asecond port to send information. For a specific manner of obtaining theprotocol type currently used by the second port to send information,refer to the foregoing content. Details are not described herein again.Step 2502 is performed when it is determined that the obtained protocoltype currently used by the second port to send information is thenon-preset protocol type; or step 2503 is performed when it isdetermined that the obtained protocol type currently used by the secondport to send information is the preset protocol type.

Step 2502: When determining that the obtained protocol type currentlyused by the second port to send information is the non-preset protocoltype, a first device determines that a protocol type supported by thesecond port of a second device is the non-preset protocol type.Correspondingly, optionally, the second device sends information basedon the preset protocol type when the second port supports the flexibleEthernet protocol and the standard Ethernet protocol. To be specific, inthis case, indication information used to indicate the protocol typecurrently used by the second port to send information may also indicatethe protocol type supported by the second port.

Step 2503: When a first device determines that the obtained protocoltype currently used by the second port to send information is the presetprotocol type, the first device receives, through the first port,indication information used to indicate a protocol type supported by thesecond port. Because the first port also supports two protocol types,protocol types currently used by the first port to receive informationand send information each are the preset protocol type. To be specific,the first port receives, through the first port based on the presetprotocol type, the indication information used to indicate the protocoltype supported by the second port. In this step, optionally, theindication information used to indicate the protocol type supported bythe second port may be information carried in an LLDP packet. In anoptional implementation, the first port receives the indicationinformation used to indicate the protocol type supported by the secondport, and may directly determine, based on the indication information,the protocol type supported by the second port.

After step 2502 and step 2503 are performed, the protocol type supportedby the second port is determined, and then step 2102 is performed. Step2102: The first device determines a target protocol type based on theprotocol type supported by the second port and a protocol type supportedby the first port, where the target protocol type includes the flexibleEthernet protocol or the standard Ethernet protocol.

Step 2103: The first device communicates with the second device based onthe target protocol type through the first port and the second port.

In this embodiment of this application, the indication information usedto indicate the protocol type supported by the second port may beinformation carried in an LLDP packet, or an LLDP packet that carriesthe indication information used to indicate the protocol type supportedby the second port may be referred to as an extended LLDP TLV in thisembodiment of this application. FIG. 16 shows an example of a schematicdiagram of an LLDP packet according to an embodiment of thisapplication. As shown in FIG. 16, related information of a type value(TLV type)=127 (7 bits) may be placed in the 1^(st) byte. For example,the type value (TLV type) may be placed in the first 7 bits of the 1byte, for example, the type value may be 127. Related information of alength (length) (9 bits) may be placed in the 2^(nd) byte. The relatedinformation of the length occupies 9 bits. In this case, a last bit inthe 1^(st) byte and the 2^(nd) byte may be used to carry the relatedinformation of the length. Information about an optical internetworkingforum organizationally unique identifier (Optical Internetworking Forumorganizationally unique identifier. OIF OUI), that is, 00-0F-40, may beplaced in the 3^(rd) to the 5^(th) byte. Related information of asubtype (Subtype) 0x?? may be placed in the 6^(th) byte. Relatedinformation of an interface capability (Interface capabilities) (1 byte)may be placed in the 7^(th) byte. Related information of a flexibleEthernet protocol group capability token (FlexE Group Capability Key) (4bytes) may be placed in the 8^(th) byte to the 11^(th) byte. Relatedinformation of a maximum quantity of interfaces supported in a flexibleEthernet group (Max # of PHYs in a FlexE group/subgroup) (1 byte) may beplaced in the 12^(th) byte. Related information to be determined (To bedetermined, TBD) may be placed in the 13^(th) byte, for example, someinformation may be newly added subsequently.

As shown in FIG. 16, optionally, the LLDP packet that carries theindication information used to indicate the protocol type supported bythe second port may include the protocol type supported by the secondport. For example, in an example of the 7^(th) byte in FIG. 16, if boththe first and second bits are 1, it indicates that the second portsupports the flexible Ethernet protocol and the standard Ethernetprotocol. For another example, in an example of the 7^(th) byte in FIG.16, if the first and second bits are sequentially “1” and “0”, itindicates that the second port supports the flexible Ethernet protocol.As shown in FIG. 16, the 6^(th) byte identifies that a value of asubtype (Subtype) of a TLV is to be determined, and a location after the12^(th) byte is reserved for subsequent extension.

Further, optionally, the LLDP packet that carries the indicationinformation used to indicate the protocol type supported by the secondport may include the flexible Ethernet protocol group capability token(FlexE Group Capability Key), and a management module of the device mayset ports having a same flexible Ethernet protocol group capabilitytoken value to be in one flexible Ethernet protocol group (FlexE Group).The flexible Ethernet protocol group may include at least one link, anda port corresponding to the link is configured to take effect.

In this embodiment of this application, determining of a target protocoltype of a port and a port (effective) configuration phase may be relatedto configuration and effective establishment of a flexible Ethernetprotocol group (FlexE Group) or a link aggregation group (LinkAggregation Group, LAG). The device may further determine a groupidentifier (Group ID) of the flexible Ethernet protocol group (FlexEGroup) and a corresponding quantity of PHYs or a specific configurationof the LAG based on information such as a system ID, a port ID, and aflexible Ethernet protocol group capability token (FlexE GroupCapability Key) of the device.

Further, optionally, the LLDP packet that carries the indicationinformation used to indicate the protocol type supported by the secondport may include a maximum quantity of interfaces supported in aflexible Ethernet group (Max # of PHYs in a FlexE group/subgroup), toindicate a maximum quantity of ports that can be included in a flexibleEthernet protocol group corresponding to the port.

Further, optionally, the management module of the device may determine aprotocol type in a working state of each port by integrating informationtransmitted in the LLDP packet. For example, information that themanagement module of the first device needs to reference to determinethe target protocol type of the first port or a protocol type in anotherworking state may include the protocol type supported by the first port,the protocol type supported by the second port, a maximum quantity ofports corresponding to a link between the first port and the secondport, a flexible Ethernet protocol group capability token correspondingto each port that can support the flexible Ethernet protocol on thefirst device, and the like.

A flexible Ethernet protocol group (FlexE Group) may be obtained bybinding one to n Ethernet PHYs (namely, Ethernet physical layers), aflexible Ethernet protocol client (FlexE Clients) may be a MAC-basedEthernet data stream, and a service rate supported by FlexE 1.0 may be10 Gb/s, 40 Gb/s, and m×25 Gb/s. A flexible Ethernet protocol layer(FlexE Shim) has a multiplexing function in a sending direction, andmaps data of the flexible Ethernet protocol client (FlexE Clients) tothe flexible Ethernet protocol group (FlexE Group). On the contrary, theflexible Ethernet protocol layer has a demultiplexing function in areceiving direction, and may demap the data from the flexible Ethernetprotocol group (FlexE Group) to the flexible Ethernet protocol client(FlexE Clients).

In this embodiment of this application, when both the first device andthe second device include a plurality of ports, a plurality of links maybe established between the first device and the second device, forexample, two 100 GEs layer-2 Ethernet connections and one 4×100G PHYflexible Ethernet protocol group (FlexE Group) may be established, sothat the first device and the second device can perform bidirectionalcommunication. Alternatively, Ethernet link aggregation may be performedon a plurality of flexible Ethernet protocol links.

It may be learned from the foregoing content that in this embodiment ofthis application, when both the first device and the second deviceinclude one port, any one of the foregoing solutions may be used. Whenthe first device and the second device include a plurality of ports, aflexible Ethernet protocol group (FlexE Group) may be furtherestablished when the solutions shown in FIG. 14 to FIG. 16 are selected.In addition, this embodiment of this application may be bettercompatible with the prior art, and more information may be integrated toautomatically determine a protocol type in a working state withoutchanging a structure of an existing device.

When both the first port and the second port support two types ofprotocols, if it is preset that a port supporting two types of protocolsis enabled by using a preset protocol type FlexE, the first port and thesecond port are first enabled in a FlexE mode, and notify a capabilityby using a MAC control packet of the LLDP protocol (that is, the firstport sends indication information used to indicate the protocol typesupported by the first port, and the second port sends the indicationinformation used to indicate the protocol type supported by the secondport).

An example is provided for description. The first port sends indicationinformation used to indicate a protocol type currently used by the firstport to send information, and the second port sends the indicationinformation used to indicate the protocol type currently used by thesecond port to send information. The first port determines whether a0x4B+0x5 code block (namely, a first preset PCS code block) is detected.If the code block is detected, it indicates that the protocol typecurrently used by the second port to send information is the FlexE, andthe first port receives, over a management channel in the FlexE protocolmode, an LLDP control packet (including the indication information usedto indicate the protocol type supported by the second port) sent by thesecond port. Alternatively, if the code block is not detected, the firstport attempts to receive an LLDP control packet in a standard Ethernetprotocol mode (it is not excluded that the LLDP control packet includesthe indication information used to indicate the protocol type supportedby the second port). Correspondingly, the second port determines whethera 0x4B+0x5 code block (namely, a first preset PCS code block) isdetected. If the code block is detected, it indicates that the protocoltype currently used by the first port to send information is the FlexE,and the second port receives, over a management channel in the FlexEprotocol mode, an LLDP control packet (including the indicationinformation used to indicate the protocol type supported by the firstport) sent by the first port. Alternatively, if the code block is notdetected, the first port attempts to receive an LLDP control packet in astandard Ethernet protocol mode (it is not excluded that the LLDPcontrol packet includes the indication information used to indicate theprotocol type supported by the first port).

FIG. 17 shows an example of a schematic flowchart of a communicationmethod according to an embodiment of this application. A port shown inFIG. 17 is a port supporting two types of protocols, and may be theforegoing first port, or may be the foregoing second port when thesecond port supports two types of protocols. A configuration state ofthe port supporting two types of protocols in each phase is as follows.

Step 2601: In an initial phase, a physical layer state of the port maybe inactive empty (inactive empty), and a physical layer configurationmay be a default physical layer configuration (default PHYconfiguration) (that is, the PHY configuration is NULL), and optionally,step 2602 and step 2603 may be performed subsequently.

Step 2602: After a link is powered on, that is, after the link isenabled, the port that can support two protocol types is fixedly enabledin a flexible Ethernet protocol type (dual mode PHY power up initial asFlexE PHY), that is, the port sends and receives information accordingto a flexible Ethernet protocol.

Step 2603: Perform FlexE neighbor discovery over a section managementchannel (FlexE neighbor discovery over section management channel), thatis, perform a temporary session (which may be the temporary sessionshown in FIG. 15, such as the temporary session in step 2501, step 2502,and step 2503) on a FlexE section management channel (FlexE sectionmanagement channel), to determine a protocol type supported by a secondport; and perform step 2604 if it is determined that a target protocoltype is a standard Ethernet protocol; or perform step 2605 if it isdetermined that a target protocol type is the flexible Ethernetprotocol.

Step 2604: Configure a PHY as a conventional Ethernet PHY (standardEthernet protocol), that is, reconfigure the PHY as a standard EthernetPHY (reconfigure the PHY as traditional Eth PHY).

Step 2605: First change PHY configuration information to be non-empty,and then enable the PHY configuration information to be active. To bespecific, the PHY is first configured as an inactive empty PHY (inactiveempty PHY) (with a non-empty PHY configuration (with non-empty PHYconfiguration)), and then the PHY is configured as an active non-emptyphysical layer (active non-empty PHY) (with the non-empty PHYconfiguration (with non-empty PHY configuration)).

Based on the foregoing embodiments and a same concept, FIG. 18 is aschematic diagram of a communications device according to an embodimentof this application. As shown in FIG. 18, the communications device 3110may be user equipment or a network device, or may be a chip or acircuit, such as a chip or a circuit that can be disposed in userequipment or a network device. The communications device may correspondto the first device in the foregoing method. The communications devicemay implement steps performed by the first device in any one or morecorresponding methods shown in FIG. 1 to FIG. 17. The communicationsdevice may include a processing unit 3111 and a transceiver unit 3112.

The transceiver unit 3112 may be the first port in the foregoingcontent, a unit disposed in the first port, or a unit bound to the firstport. Information sent or received by the transceiver unit 3112 istransmitted through the first port. In a possible design, thecommunications device 3110 may be the first device 1101 in FIG. 1 in theforegoing content. The processing unit 3111 may be integrated into themanagement module 1102, may be integrated into the first port, or mayexist in the first device 1101 independent of the management module 1102and the first port.

In the following, this embodiment focuses on describing a function ofthe transceiver unit 3112 serving as a unit of a receive end when thefirst device serves as the receive end. The transceiver unit 3112 mayalso perform a related solution performed when the first device servesas a transmit end. For a method procedure performed when the transceiverunit 3112 serves as a unit of the transmit end, refer to the foregoingrelated solution of the second port.

The processing unit 3111 obtains a protocol type supported by a secondport of a second device, and determines a target protocol type based onthe protocol type supported by the second port and a protocol typesupported by the first port. The target protocol type includes aflexible Ethernet protocol or a standard Ethernet protocol, the protocoltype supported by the second port of the second device includes theflexible Ethernet protocol and/or the standard Ethernet protocol, andthe first port of the first device supports the flexible Ethernetprotocol and the standard Ethernet protocol. The transceiver unit 3112is configured to communicate with the second device based on the targetprotocol type through the first port and the second port.

In a possible design, the transceiver unit 3112 is configured to sendinformation to the second port of the second device based on the targetprotocol type through the first port. In a possible design, thetransceiver unit 3112 is configured to receive, based on the targetprotocol type through the first port, information sent from the secondport of the second device. In a possible design, the transceiver unit3112 is configured to send information to the second port of the seconddevice based on the target protocol type through the first port, andreceive, based on the target protocol type through the first port,information sent from the second port of the second device.

In a possible design, the processing unit 3111 is configured to obtain,by using a physical coding sublayer PCS code block, a protocol typecurrently used by the second port to send information.

In a possible design, the processing unit 3111 is configured to: when afirst preset PCS code block is received by using the transceiver unit3112, determine that the protocol type currently used by the second portto send information is the flexible Ethernet protocol; or when a firstpreset PCS code block is not received by using the transceiver unit3112, determine that the protocol type currently used by the second portto send information is the standard Ethernet protocol.

In a possible design, the transceiver unit 3112 is configured toreceive, through the first port based on the obtained protocol typecurrently used by the second port to send information, indicationinformation used to indicate the protocol type supported by the secondport.

In a possible design, the indication information used to indicate theprotocol type supported by the second port is carried in a controlpacket at a medium access control MAC layer; or the indicationinformation used to indicate the protocol type supported by the secondport is carried in a control packet at another layer higher than a MAClayer.

In a possible design, the processing unit 3111 is configured to: whendetermining that the obtained protocol type currently used by the secondport to send information is a non-preset protocol type, determine thatthe protocol type supported by the second port of the second device isthe non-preset protocol type. A preset protocol type includes theflexible Ethernet protocol, and the non-preset protocol type includesthe standard Ethernet protocol; or a preset protocol type includes thestandard Ethernet protocol, and the non-preset protocol type includesthe flexible Ethernet protocol.

In a possible design, the processing unit 3111 is configured to obtain,by using the PCS code block, the protocol type supported by the secondport.

The processing unit 3111 determines that the second port supports aplurality of protocol types. For example, at least one of the followingcontent may be included. In a possible design, the processing unit 3111is configured to: when a second preset PCS code block is received byusing the transceiver unit 3112, determine that the protocol typesupported by the second port includes the flexible Ethernet protocol andthe standard Ethernet protocol. In a possible design, the processingunit 3111 is configured to: when a second preset PCS code block is notreceived by using the transceiver unit 3112 and the first preset PCScode block is received, determine that the protocol type supported bythe second port is the flexible Ethernet protocol. In a possible design,the processing unit 3111 is configured to: when neither a second presetPCS code block nor the first preset PCS code block is received by usingthe transceiver unit 3112, determine that the protocol type supported bythe second port is the standard Ethernet protocol.

In a possible design, the first preset PCS code block includes an OHframe header code block of the flexible Ethernet protocol.

It may be understood that for functions of the units in thecommunications device 3110, refer to implementation of a correspondingmethod embodiment. Details are not described herein again.

Based on the foregoing embodiments and a same concept, FIG. 19 is aschematic diagram of a communications device according to an embodimentof this application. As shown in FIG. 19, the communications device 4110may be user equipment or a network device, or may be a chip or acircuit, such as a chip or a circuit that can be disposed in userequipment or a network device. The communications device may correspondto the second device in the foregoing method. The communications devicemay implement steps performed by the second device in any one or morecorresponding methods shown in FIG. 1 to FIG. 17. The communicationsdevice may include a processing unit 4111 and a transceiver unit 4112.

The transceiver unit 4112 may be the second port in the foregoingcontent, a unit disposed in the second port, or a unit bound to thesecond port. Information sent or received by the transceiver unit 4112is transmitted through the second port. In a possible design, thecommunications device 4110 may be the second device 1201 in FIG. 1 inthe foregoing content. The processing unit 4111 may be integrated intothe management module 1202, may be integrated into the second port, ormay exist in the second device 1201 independent of the management module1202 and the second port.

In the following, this embodiment focuses on describing a function ofthe transceiver unit 4112 serving as a unit of a transmit end when thesecond device serves as the transmit end. The transceiver unit 4112 mayalso perform a related solution performed when the second device servesas a receive end. When the transceiver unit 4112 serves as a unit of thereceive end, and the second port supports two protocol types, for amethod procedure performed by the transceiver unit 4112, refer to theforegoing related solution of the first port.

The processing unit 4111 is configured to generate indicationinformation used to indicate a protocol type supported by the secondport of the second device, and the protocol type supported by the secondport of the second device includes a flexible Ethernet protocol and/or astandard Ethernet protocol. The transceiver unit 4112 is configured tosend the indication information used to indicate the protocol typesupported by the second port.

In a possible design, the transceiver unit 4112 is configured to send,by using a physical coding sublayer PCS code block, indicationinformation used to indicate a protocol type currently used by thesecond port to send information.

In a possible design, when the protocol type currently used by thesecond port to send information is the flexible Ethernet protocol, theprocessing unit 4111 sends a first preset PCS code block by using thetransceiver unit 4112.

In a possible design, the processing unit 4111 is configured to: whenthe second port supports the flexible Ethernet protocol and the standardEthernet protocol, send information based on a preset protocol type byusing the transceiver unit 4112.

If the preset protocol type is the flexible Ethernet protocol, theinformation includes the first preset PCS code block; or if the presetprotocol type is the standard Ethernet protocol, the information doesnot include the first preset PCS code block.

In a possible design, the indication information used to indicate theprotocol type supported by the second port of the second device iscarried in a control packet at a medium access control MAC layer; or theindication information used to indicate the protocol type supported bythe second port of the second device is carried in a control packet atanother layer higher than a MAC layer.

In a possible design, the indication information used to indicate theprotocol type supported by the second port is carried in the PCS codeblock.

In a possible design, the processing unit 4111 is configured to: whenthe second port supports the flexible Ethernet protocol and the standardEthernet protocol, send, by using the transceiver unit 4112, informationincluding a second preset PCS code block.

The processing unit 4111 is configured to: when the second port supportsthe flexible Ethernet protocol, send, by using the transceiver unit4112, information that does not include a second preset PCS code blockand includes the first preset PCS code block.

The processing unit 4111 is configured to: when the second port supportsthe standard Ethernet protocol, send, by using the transceiver unit4112, information including neither a second preset PCS code block northe first preset PCS code block.

In a possible design, the first preset PCS code block includes an OHframe header code block of the flexible Ethernet protocol.

In a possible design, the protocol type supported by the second portincludes the flexible Ethernet protocol and the standard Ethernetprotocol. The transceiver unit 4112 is further configured to send firstindication information; or the transceiver unit 4112 is furtherconfigured to send first indication information and second indicationinformation. The first indication information is used to indicate aprotocol type with a higher priority in the protocol type supported bythe second port, and the second indication information is used toindicate a priority level of the protocol type with a higher priority inthe protocol type supported by the second port.

It may be understood that for functions of the units in thecommunications device 4110, refer to implementation of a correspondingmethod embodiment. Details are not described herein again.

Based on the foregoing method, FIG. 20 is a schematic structural diagramof a communications device according to an embodiment of thisapplication. As shown in FIG. 20, the communications device may be userequipment or a network device 20, or may be a chip or a circuit, such asa chip or a circuit that can be disposed in user equipment, or a chip ora circuit that can be disposed in a network device.

When the communications device corresponds to the first device in theforegoing method, the communications device may include a processor 110and a memory 120. The memory 120 is configured to store an instruction.The processor 110 is configured to execute the instruction stored in thememory 120, to implement the related solution of the first device in oneor more corresponding methods shown in FIG. 1 to FIG. 17.

Further, the device may include an input port 140 and an output port150. Further, the device may include a bus system 130, and the processor110, the memory 120, the input port 140, and the output port 150 may beconnected by using the bus system 130. The input port 140 and the outputport 150 correspond to a first port, that is, information received bythe input port 140 and information sent by the output port 150 aretransmitted through the first port. The input port 140 and the outputport 150 may be integrated into the first port, or may be in a bindingrelationship with the first port.

The processor 110 is configured to execute the instruction stored in thememory 120, to control the input port 140 to receive a signal andcontrol the output port 150 to send a signal, to complete the steps ofthe first device in the foregoing method. The input port 140 and theoutput port 150 may be a same physical entity or different physicalentities. When the input port 140 and the output port 150 are a samephysical entity, the input port 140 and the output port 150 may becollectively referred to as an input/output port, or may be referred toas a transceiver. The memory 120 may be integrated into the processor110, or the memory 120 and the processor 110 may be disposed separately.

In an implementation, it may be considered that functions of the inputport 140 and the output port 150 are implemented by using a transceivercircuit or a dedicated transceiver chip. It may be considered that theprocessor 110 is implemented by using a dedicated processing chip,processing circuit, or processor, or a universal chip.

In another implementation, it may be considered that the communicationsdevice provided in this embodiment of this application is implemented byusing a general purpose computer. To be specific, program code forimplementing functions of the processor 110, the input port 140, and theoutput port 150 are stored in the memory, and a general purposeprocessor implements the functions of the processor 110, the input port140, and the output port 150 by executing the code in the memory.

For a concept, explanations, detailed descriptions, and other steps usedin the device that are related to the technical solution provided inthis embodiment of this application, refer to the descriptions of thecontent in the foregoing method or in another embodiment. Details arenot described herein again.

Based on the foregoing method. FIG. 21 is a schematic structural diagramof a communications device according to an embodiment of thisapplication. As shown in FIG. 21, the communications device may be userequipment or a network device 20, or may be a chip or a circuit, such asa chip or a circuit that can be disposed in user equipment, or a chip ora circuit that can be disposed in a network device.

When the communications device corresponds to the second device in theforegoing method, the communications device may include a processor 210and a memory 220. The memory 220 is configured to store an instruction.The processor 210 is configured to execute the instruction stored in thememory 220, to implement the related solution of the second device inone or more corresponding methods shown in FIG. 1 to FIG. 17.

Further, the device may include an input port 240 and an output port250. Further, the device may include a bus system 230, and the processor210, the memory 220, the input port 240, and the output port 250 may beconnected by using the bus system 230. The input port 240 and the outputport 250 correspond to a second port, that is, information received bythe input port 240 and information sent by the output port 250 aretransmitted through the second port. The input port 240 and the outputport 250 may be integrated into the second port, or may be in a bindingrelationship with the second port.

The processor 210 is configured to execute the instruction stored in thememory 220, to control the input port 240 to receive a signal andcontrol the output port 250 to send a signal, to complete the steps ofthe second device in the foregoing method. The input port 240 and theoutput port 250 may be a same physical entity or different physicalentities. When the input port 240 and the output port 250 are a samephysical entity, the input port 240 and the output port 250 may becollectively referred to as an input/output port, or may be referred toas a transceiver. The memory 220 may be integrated into the processor210, or the memory 220 and the processor 210 may be disposed separately.

In an implementation, it may be considered that functions of the inputport 240 and the output port 250 are implemented by using a transceivercircuit or a dedicated transceiver chip. It may be considered that theprocessor 210 is implemented by using a dedicated processing chip,processing circuit, or processor, or a universal chip.

In another implementation, it may be considered that the user equipmentprovided in this embodiment of this application is implemented by usinga general purpose computer. To be specific, program code forimplementing functions of the processor 210, the input port 240, and theoutput port 250 are stored in the memory, and the general purposeprocessor implements the functions of the processor 210, the input port240, and the output port 250 by executing the code in the memory.

For a concept, explanations, detailed descriptions, and other steps usedin the device that are related to the technical solution provided inthis embodiment of this application, refer to the descriptions of thecontent in the foregoing method or in another embodiment. Details arenot described herein again.

According to the foregoing method, FIG. 22 is a schematic structuraldiagram of a network device according to an embodiment of thisapplication, for example, may be a schematic structural diagram of abase station. As shown in FIG. 22, the base station may be applied tothe first device or the second device shown in FIG. 1. The base station20 includes one or more radio frequency units such as a remote radiounit (remote radio unit, RRU) 201 and one or more baseband units(baseband unit, BBU) (which may also be referred to as digital units(digital unit, DU)) 202. The RRU 201 may be referred to as a transceiverunit, a transceiver, a transceiver circuit, a transceiver, or the like,and may include at least one antenna 2011 and a radio frequency unit2012. The RRU 201 is mainly configured to receive and send a radiofrequency signal and perform conversion between the radio frequencysignal and a baseband signal.

The BBU 202 is mainly configured to perform baseband processing, controlthe base station, and the like. The RRU 201 and the BBU 202 may bephysically disposed together, or may be physically disposed separately,that is, the base station is a distributed base station.

The BBU 202 is a control center of the base station, may also bereferred to as a processing unit, and is mainly configured to implementa baseband processing function, such as channel coding, multiplexing,modulation, and spectrum spreading.

For example, the BBU 202 may include one or more boards, and a pluralityof boards may jointly support a radio access network (such as an LTEnetwork) of a single access standard, or may separately support radioaccess networks of different access standards. The BBU 202 furtherincludes a memory 2021 and a processor 2022. The memory 2021 isconfigured to store necessary instructions and data. For example, thememory 2021 stores a protocol type supported by the first port and/or aprotocol type supported by the second port in the foregoing embodiment.

The processor 2022 is configured to control the base station to performa necessary action. For example, when the network device performs thesolution performed by the foregoing first device, the processor may beconfigured to: obtain a protocol type supported by a second port of asecond device; determine a target protocol type based on the protocoltype supported by the second port and a protocol type supported by afirst port; and communicate with the second device based on the targetprotocol type through the first port and the second port. For a relatedsolution to obtaining the protocol type supported by the second port ofthe second device and another related solution of the first device,refer to the foregoing method procedure.

When the network device performs the solution performed by the foregoingsecond device, the processor may be configured to: generate indicationinformation used to indicate a protocol type supported by a second portof the second device; and send, by using the transceiver unit, theindication information used to indicate the protocol type supported bythe second port. For another related solution of the second device,refer to the foregoing method procedure.

The memory 2021 and the processor 2022 may serve one or more boards. Inother words, a memory and a processor may be separately disposed on eachboard, or a plurality of boards may share a same memory and processor.In addition, a necessary circuit may be disposed on each board.

According to the method provided in the embodiments of this application,an embodiment of this application further provides a communicationssystem, and the communications system includes the network device andone or more user equipments.

It should be understood that in the embodiments of this application, anyof the processor 2022 in FIG. 22, the processor 110 in FIG. 20, and theprocessor 210 in FIG. 21 may be a central processing unit (CentralProcessing Unit, “CPU” for short), or the processor may be anothergeneral purpose processor, a digital signal processor (DSP), anapplication-specific integrated circuit (ASIC), a field programmablegate array (FPGA) or another programmable logic device, a discrete gateor a transistor logic device, a discrete hardware component, or thelike. The general purpose processor may be a microprocessor, or theprocessor may be any conventional processor or the like.

In the embodiments of this application, any one of the memory 2021 inFIG. 22, the memory 120 in FIG. 20, and the memory 220 in FIG. 21 mayinclude a read-only memory and a random access memory, and provide aninstruction and data to the processor. A part of the memory may furtherinclude a nonvolatile random access memory.

In the embodiments of this application, the bus system may include apower bus, a control bus, a status signal bus, and the like in additionto a data bus. However, for clear description, various buses are markedas the bus system in the figure, for example, the bus system 130 in FIG.20 and the bus system 230 in FIG. 21.

In an implementation process, steps in the foregoing methods can beimplemented by using an integrated logical circuit of hardware in aprocessor, or by using instructions in a form of software. The steps ofthe method disclosed with reference to the embodiments of thisapplication may be directly performed by a hardware processor, or may beperformed by using a combination of hardware in a processor and asoftware unit. The software unit may be located in a mature storagemedium in the art, such as a random access memory, a flash memory, aread-only memory, a programmable read-only memory, an electricallyerasable programmable memory, or a register. The storage medium islocated in a memory, and a processor reads information in the memory andcompletes the steps in the foregoing methods in combination withhardware in the processor. To avoid repetition, details are notdescribed herein.

It should be further understood that the first, the second, the third,the fourth, and various numbers in this specification are used fordifferentiation only for ease of description, instead of limiting thescope of the embodiments of this application.

It should be understood that the term “and/or” in this specification ismerely an association relationship for describing associated objects andrepresents that three relationships may exist. For example, A and/or Bmay represent the following three cases: Only A exists, both A and Bexist, and only B exists. In addition unless otherwise specified, thecharacter “I” in this specification usually indicates an “or”relationship between the associated objects.

It should be understood that sequence numbers of the foregoing processesdo not mean execution sequences in various embodiments of thisapplication. The execution sequences of the processes should bedetermined according to functions and internal logic of the processes,and should not be construed as any limitation on the implementationprocesses of the embodiments of this application.

A person of ordinary skill in the art may be aware that, in combinationwith illustrative logical blocks (illustrative logical block) and steps(step) described in the embodiments disclosed in this specification maybe implemented by electronic hardware or a combination of computersoftware and electronic hardware. Whether the functions are performed byhardware or software depends on particular applications and designconstraints of the technical solutions. A person skilled in the art mayuse different methods to implement the described functions for eachparticular application, but it should not be considered that theimplementation goes beyond the scope of this application.

It may be clearly understood by a person skilled in the art that, forthe purpose of convenient and brief description, for a detailed workingprocess of the foregoing system, device, and unit, refer to acorresponding process in the foregoing method embodiments. Details arenot described herein again.

In the several embodiments provided in this application, it should beunderstood that the disclosed system, device, and method may beimplemented in other manners. For example, the described deviceembodiment is merely an example. For example, the unit division ismerely logical function division and may be other division in actualimplementation. For example, a plurality of units or components may becombined or integrated into another system, or some features may beignored or not performed. In addition, the displayed or discussed mutualcouplings or direct couplings or communication connections may beimplemented through some interfaces. The indirect couplings orcommunication connections between the devices or units may beimplemented in electrical, mechanical, or other forms.

The units described as separate parts may or may not be physicallyseparate, and parts displayed as units may or may not be physical units,may be located in one position, or may be distributed on a plurality ofnetwork units. Some or all of the units may be selected based on actualrequirements to achieve the objectives of the solutions of theembodiments.

In addition, functional units in the embodiments of this application maybe integrated into one processing unit, or each of the units may existalone physically, or two or more units are integrated into one unit.

All or some of the foregoing embodiments may be implemented by usingsoftware, hardware, firmware, or any combination thereof. When softwareis used to implement the embodiments, the embodiments may be all orpartially implemented in a form of a computer program product. Thecomputer program product includes one or more computer instructions.When the computer program instructions are loaded and executed on acomputer, the procedures or functions according to the embodiments ofthis application are all or partially generated. The computer may be ageneral purpose computer, a dedicated computer, a computer network, oranother programmable device. The computer instructions may be stored ina computer-readable storage medium or may be transmitted from acomputer-readable storage medium to another computer-readable storagemedium. For example, the computer instructions may be transmitted from awebsite, computer, server, or data center to another website, computer,server, or data center in a wired (for example, a coaxial cable, anoptical fiber, or a digital subscriber line (DSL)) or wireless (forexample, infrared, radio, or microwave) manner. The computer-readablestorage medium may be any usable medium accessible by a computer, or adata storage device, such as a server or a data center, integrating oneor more usable media. The usable medium may be a magnetic medium (forexample, a floppy disk, a hard disk, or a magnetic tape), an opticalmedium (for example, a DVD), a semiconductor medium (for example, asolid state drive Solid State Disk (SSD)), or the like.

The foregoing descriptions are merely specific implementations of thisapplication, but are not intended to limit the protection scope of thisapplication. Any variation or replacement readily figured out by aperson skilled in the art within the technical scope disclosed in thisapplication shall fall within the protection scope of this application.Therefore, the protection scope of this application shall be subject tothe protection scope of the claims.

1. A communication method, comprising: obtaining, by a first device, aprotocol type supported by a second port of a second device, wherein theprotocol type supported by the second port of the second devicecomprises at least one of a flexible Ethernet protocol or a standardEthernet protocol, and wherein a first port of the first device supportsthe flexible Ethernet protocol and the standard Ethernet protocol;determining, by the first device, a target protocol type based on theprotocol type supported by the second port and a protocol type supportedby the first port, wherein the target protocol type comprises theflexible Ethernet protocol or the standard Ethernet protocol; andcommunicating, by the first device, with the second device based on thetarget protocol type through the first port and the second port.
 2. Themethod according to claim 1, wherein the communicating, by the firstdevice, with the second device based on the target protocol type throughthe first port and the second port comprises at least one of: sending,by the first device, information to the second port of the second devicebased on the target protocol type through the first port; or receiving,by the first device based on the target protocol type through the firstport, information sent from the second port of the second device.
 3. Themethod according to claim 1, before the determining, by the firstdevice, a target protocol type, further comprising: obtaining, by thefirst device by using a physical coding sublayer (PCS) code block, aprotocol type currently used by the second port to send information. 4.The method according to claim 3, wherein the obtaining, by the firstdevice by using a PCS code block, a protocol type currently used by thesecond port to send information comprises: when a first preset PCS codeblock is received, determining, by the first device, that the protocoltype currently used by the second port to send information is theflexible Ethernet protocol; or when a first preset PCS code block is notreceived, determining, by the first device, that the protocol typecurrently used by the second port to send information is the standardEthernet protocol.
 5. The method according to claim 1, wherein theobtaining, by a first device, a protocol type supported by a second portof a second device comprises: receiving, by the first device through thefirst port based on the obtained protocol type currently used by thesecond port to send information, indication information indicating theprotocol type supported by the second port.
 6. The method according toclaim 5, wherein: the indication information indicating the protocoltype supported by the second port is carried in a control packet at amedium access control (MAC) layer; or the indication informationindicating the protocol type supported by the second port is carried ina control packet at another layer higher than a MAC layer.
 7. The methodaccording to claim 1, wherein the obtaining, by a first device, aprotocol type supported by a second port of a second device comprises:when determining that the obtained protocol type currently used by thesecond port to send information is a non-preset protocol type,determining, by the first device, that the protocol type supported bythe second port of the second device is the non-preset protocol type,wherein: a preset protocol type comprises the flexible Ethernetprotocol, and the non-preset protocol type comprises the standardEthernet protocol; or a preset protocol type comprises the standardEthernet protocol, and the non-preset protocol type comprises theflexible Ethernet protocol.
 8. The method according to claim 3, whereinthe obtaining, by a first device, a protocol type supported by a secondport of a second device comprises: obtaining, by the first device byusing the PCS code block, the protocol type supported by the secondport.
 9. A communication method, comprising: generating, by a seconddevice, indication information indicating a protocol type supported by asecond port of the second device, wherein the protocol type supported bythe second port of the second device comprises at least one of aflexible Ethernet protocol or a standard Ethernet protocol; and sending,by the second device, the indication information indicating the protocoltype supported by the second port.
 10. The method according to claim 9,wherein the method further comprises: sending, by the second device byusing a physical coding sublayer (PCS) code block, indicationinformation indicating a protocol type currently used by the second portto send information.
 11. The method according to claim 10, wherein thesending, by the second device by using a physical coding sublayer (PCS)code block, indication information indicating a protocol type currentlyused by the second port to send information comprises: sending, by thesecond device, a first preset PCS code block when the protocol typecurrently used by the second port to send information is the flexibleEthernet protocol.
 12. The method according to claim 11, wherein thesending, by the second device, the indication information indicating theprotocol type supported by the second port comprises: when the secondport supports the flexible Ethernet protocol and the standard Ethernetprotocol, sending, by the second device, information based on a presetprotocol type, wherein: if the preset protocol type is the flexibleEthernet protocol, the information comprises the first preset PCS codeblock; or if the preset protocol type is the standard Ethernet protocol,the information does not comprise the first preset PCS code block. 13.The method according to claim 9, wherein: the indication informationindicating the protocol type supported by the second port of the seconddevice is carried in a control packet at a medium access control (MAC)layer; or the indication information indicating the protocol typesupported by the second port of the second device is carried in acontrol packet at another layer higher than a MAC layer.
 14. The methodaccording to claim 11, wherein the indication information indicating theprotocol type supported by the second port is carried in the firstpreset PCS code block.
 15. A communications device, comprising: at leastone processor, the at least one processor configured to: obtain aprotocol type supported by a second port of a second device; anddetermine a target protocol type based on the protocol type supported bythe second port and a protocol type supported by a first port, whereinthe protocol type supported by the second port of the second devicecomprises at least one of a flexible Ethernet protocol or a standardEthernet protocol, wherein the first port of a first device supports theflexible Ethernet protocol and the standard Ethernet protocol, andwherein the target protocol type comprises the flexible Ethernetprotocol or the standard Ethernet protocol; and a transceiver, thetransceiver configured to communicate with the second device based onthe target protocol type through the first port and the second port. 16.The communications device according to claim 15, wherein the transceiveris configured to perform at least one of: sending information to thesecond port of the second device based on the target protocol typethrough the first port; or receiving, based on the target protocol typethrough the first port, information sent from the second port of thesecond device.
 17. The communications device according to claim 15,wherein the at least one processor is further configured to obtain, byusing a physical coding sublayer (PCS) code block, a protocol typecurrently used by the second port to send information.
 18. Thecommunications device according to claim 17, wherein the at least oneprocessor is configured to: when a first preset PCS code block isreceived by using the transceiver, determine that the protocol typecurrently used by the second port to send information is the flexibleEthernet protocol; or when a first preset PCS code block is not receivedby using the transceiver, determine that the protocol type currentlyused by the second port to send information is the standard Ethernetprotocol.
 19. The communications device claim 15, wherein thetransceiver is configured to: receive, through the first port based onthe obtained protocol type currently used by the second port to sendinformation, indication information indicating the protocol typesupported by the second port.
 20. The communications device according toclaim 19, wherein: the indication information indicating the protocoltype supported by the second port is carried in a control packet at amedium access control (MAC) layer; or the indication informationindicating the protocol type supported by the second port is carried ina control packet at another layer higher than a MAC layer.